Hello!
I've created an automation that compares between several date fields (custom fields) and should take the MIN date and insert it to 'Start Date' field.
The automation shows 'Success' but nothing is updating.
Please help :)
Hi @Alon Shoham
I see at least two things to improve your rule...
The MIN function needs to be enclosed in a mathematical expression, and cannot be used stand-alone as you show. It needs the {{#=}} and {{/}} wrapping. Please look here for examples of that: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/
Next, created variables are text-type, and so must be converted to a date-type before you may use the format() function. Please try converting with toDate first, such as with this:
{{MinStartDate.toDate.format("MM-dd-yyyy")}}
Kind regards,
Bill
Thanks for the detailed answer @Bill Sheboy
I change the Variable and 'edit issue' syntax . Yet the same thing, shows 'success' but nothing is updated in the ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is interesting (and perhaps a defect): even though the mathematical functions work with numbers and dates, the MIN() function appears to not recognize dates as numbers with this syntax:
{{#=}}MIN({{issue.oneDateField}},{{issue.anotherDateField}}){{/}}
That appears to be true even when the dates are forced into a list for using the list-based min function.
One work-around for your use case appears to be converting to a sortable date format before using MIN(), such as this:
{{#=}}MIN({{issue.oneDateField.format("yyyyMMdd")}},{{issue.anotherDateField.format("yyyyMMdd")}}){{/}}
Please try that to set your created variable named MinStartDate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alon Shoham can you try logging both the variable ({{MinStartDate}}) and the formatted version you're trying to put into your Start Date field? The date calculation may not be what you expect.
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.
@Alon Shoham I was suggesting you use the Log action to print out the value of your smart variable (both the plain variable and the variable with the format function) to the rule's audit log to see what the values actually are.
However, @Bill Sheboy has given you much more info already.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.