In Automation, I want to find the earliest date from a list of dates and use it to populate another field within the same issue.
For example, in my issue, I may have a list of dates like:
I want to look at all those dates and pick the one that comes first — April 5 — and set another field using that date.
My list of fields are:
The output of field is "customfield_10652":"2025-04-25".
I have tried the following (with a reduced number of fields):
--------------
Create Variable
Variable Name = TestVariable
Smart Value = {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min: {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
It should show "25 Apr 2025".
--------------
Log Action
Log message = {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min: Earliest Date: {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
It should show "25 Apr 2025".
--------------
Edit work item
Field = Start date
Value = {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
Error - Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min: {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].min}}
It should show "25 Apr 2025".
--------------
Create Variable
Variable Name = TestVariable
Smart value = {{[issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min}}
Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min: {{[issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min}}
It should show "25 Apr 2025".
--------------
Edit work item
Field = Start date
Value = {{[issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min}}
Error - Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min: {{[issue.customfield_10652.jiraDateTime, issue.customfield_10713.jiraDateTime, issue.customfield_10659.jiraDateTime].min}}
It should show "25 Apr 2025".
--------------
Create Variable
Variable Name = TestVariable
Smart Value = {{#=}}min({{issue.customfield_10652}}, {{issue.customfield_10713}}, {{issue.customfield_10659}}){{/}}
Log = "TestVariable: 1995"
It should show "25 Apr 2025".
--------------
Create Variable
Variable Name = TestVariable
Smart Value = {{#=}}min({{issue.customfield_10652.jiraDate}}, {{issue.customfield_10713.jiraDate}}, {{issue.customfield_10659.jiraDate}}){{/}}
Log = "TestVariable: 1994"
It should show "25 Apr 2025".
--------------
Create Variable
Variable Name = TestVariable
Smart Value = {{#=}}min({{issue.customfield_10652.jiraDateTime}}, {{issue.customfield_10713.jiraDateTime}}, {{issue.customfield_10659.jiraDateTime}}){{/}}
Error - Unable to render smart values when executing this rule:
Unknown operator : at character position 18: min(2025-04-26T00:00:00.0+0000, 2025-04-25T00:00:00.0+0000, 2025-04-25T00:00:00.0+0000)
It should show "25 Apr 2025".
--------------
Create Variable
Variable Name = TestVariable
Smart Value = {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].filter(notNull).min}}
Error - Unable to render smart values when executing this rule:
Failed to get value for [issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].filter(notNull).min: {{[issue.customfield_10652, issue.customfield_10713, issue.customfield_10659].filter(notNull).min}}
It should show "25 Apr 2025".
--------------
Edit work item
Advanced fields =
{
"fields": {
"customfield_10015": "{{issue.customfield_10652.jiraDate.min(issue.customfield_10713.jiraDate).min(issue.customfield_10659.jiraDate)}}"
}
}
Error - Error editing work items
PMOV2-476 (The Start date must be of the format "yyyy-MM-dd" (customfield_10015))
It should show "25 Apr 2025".
--------------
Edit work item
Advanced fields =
{
"fields": {
"customfield_10015": "{{issue.customfield_10652.jiraDate.min(issue.customfield_10713.jiraDate).min(issue.customfield_10659.jiraDate).toString(\"yyyy-MM-dd\")}}"
}
}
Error - Error editing work items
PMOV2-476 (The Start date must be of the format "yyyy-MM-dd" (customfield_10015))
It should show "25 Apr 2025".
--------------
Edit work item
Advanced fields =
{
"fields": {
"customfield_10015": "{{issue.customfield_10652.min(issue.customfield_10713).min(issue.customfield_10659).toString(\"yyyy-MM-dd\")}}"
}
}
Error - Error editing work items
PMOV2-476 (The Start date must be of the format "yyyy-MM-dd" (customfield_10015))
It should show "25 Apr 2025".
Hi @Andy
I believe the problem is that you need to create a variable for the custom fields before comparing them. Here's a post with a very similar question that got resolved:
Kind regards,
Ana
Thank you @Ana Livia Rocha Silva :-) That was driving me crazy!
This was solved by first creating a variable with the smart values "{{issue.FieldA.jiraDate}},{{issue.FieldB.jiraDate}},{{issue.FieldC.jiraDate}},{{issue.FieldD.jiraDate}}" (replace with fields required).
Then in the edit issue action, chose the field to set and add "{{VARIABLENAME.split(",").toDate.min}}".
This also works if a field being compared is blank (but it will not work if all of the dates are empty).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.