Automation: Rule should be failing, but automation performing action anyway

Louise Baker
Contributor
September 3, 2024

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??lastcomment-audit.pnglastcomment-details.png

3 answers

0 votes
Louise Baker
Contributor
September 3, 2024

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

0 votes
Bharat Kalia
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2024

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,

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2024

No, as the CF is a date time field.

The comparison should be on the date of today as a whole

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2024

Hi @Louise Baker 

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 

Louise Baker
Contributor
September 3, 2024

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?

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2024

Hi @Louise Baker 

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?

Louise Baker
Contributor
September 3, 2024

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.

Like Marc - Devoteam likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events