Hi there!
I need some help with automation involving comparing dates.
The end goal: if a comment is added to the ticket, compare the custom field "Last Commented Date". If the date is NOT 'today', then update the field. If it IS today, leave as is.
Attached is the rule details, plus the audit log of the most recent.
The last step in my rule is to log the date formats I'm using in the if rule, so I can confirm the date formats match.
In the attached audit log, you can see the date formats DO match, so the rule should NOT be updating the ticket, yet it is.
The "Then, Edit issue fields" is to update the custom field with {{now}} (so it includes timestamp). Could this be the issue? It doesn't seem so, since the log is showing that these two timestamps DO match.
I'm puzzled. Any advice??
I "solved" my issue by going another route
{{issue.customfield_10305.diff(now).days}} > 0
Now, if the last recorded comment date was NOT today, based on days, then it gets updated.
I'm still not certain why the previous date comparison was not working.
2024-09-03 != 2024-09-03 seems pretty straightforward, but it was still logging action despite them matching
Hello @Louise Baker - I think you just have to fix the comparison in the if statement. Try using - {{Issue.customfield_10305}} does not equal to {{now.jiraDate}}.
This should fix the problem. Let me know how it goes.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, as the CF is a date time field.
The comparison should be on the date of today as a whole
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suspect the custom field is a date field, but now is date/time.
See smart values in jira documentation -> https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
Also check this earlier community article; Advanced-Automation-date-comparison-with-now-StartOfMonth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The custom field is a date/time (it reports the format of Sep 3, 2024, 11:35 PM)
However, shouldn't the conversion to .jiraDate for both now and the custom field put them on equal footing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is correct, but both so todays date, after the edit action.
What do you get as log information of you would log the value of the CF before the if statement, what does the audit log then present?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahh good point!
I moved it to ahead of the IF, and tested a few times, and the log returns the same date formats but the action still logs.
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.