Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation - check if JSM Form date is today

Jack Brickey
Community Champion
May 14, 2025

Hi Automation folks I have created the following automation rule, and cannot seem to get it to work. I am thinking it has to do with the formatting of the form date but unsure. I've tried a lot of different variations, but have not been able to get it to work. I would love others thoughts on what may be going wrong here.

Below, I have included the rule and the audit log. In the rule, I am accessing a date field in a JSM form using the UUID. I am then comparing that date field to today.

My two variables:

  • {{endDate}}== {{issue.forms.ce0ce3fc-5a3b-4e86-85f5-0eeee44094b1.last.eap-enddate.jiraDate}}
  • {{fred}}== {{now().jiraDate}}

IMG_5722.pngIMG_5723.png

4 answers

1 accepted

4 votes
Answer accepted
Bill Sheboy
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.
May 14, 2025

Hi @Jack Brickey 

Created variables are text (regardless of the source type).  And so when the condition comparisons are done on text, that uses alphanumeric comparison.

If you want to compare them as dates, first use toDate to convert them, and then use appropriate date / time functions or conditions:

 

Kind regards,
Bill

Jack Brickey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2025

wow... i did not know that, clearly. I guess all this time my variables have been text. 

Thanks Bill, I will give that a go.

Like # people like this
Bill Sheboy
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.
May 14, 2025

FYI for a workaround when preserving the data typing is desired (for Jira Cloud rules)...

Rather than using Create Variable, use Create Lookup Table as the team got it to preserve the typing and structure of the source.  

For example, this is helpful in situations where one wants things like multiple Lookup Issues results:

  • action: lookup Issues
  • action: create lookup table
    • name: varFirstLookup
    • row
      • key: first
      • value: {{lookupIssues}}
  • action: lookup Issues...with different JQL this time
  • action: something that needs both, such as Send Email
    • get the first lookup's data with {{varFirstLookup.get("first")}}
    • get the second with {{lookupIssues}}

 

Like # people like this
Jack Brickey
Community Champion
May 14, 2025

good tip.

I did get this automation working and took a slightly different approach which your answer clued me in on. I decided to use the following 

/ Gets the number of days between two dates

{{now.diff(issue.created).days}}

which looked like this...

{{now.diff(issue.forms.ce0ce3fc-5a3b-4e86-85f5-0eeee44094b1.last.eap-enddate).days}}

and then used that to compare to 0

Like # people like this
2 votes
Mikael Sandberg
Community Champion
May 14, 2025

Hi @Jack Brickey ,

Have you tried date compare? In your case it would be {{fred.compareTo.(endDate)}}. If the returned value is 0 then the two dates are the same.

Jack Brickey
Community Champion
May 14, 2025

Hi @Mikael Sandberg , I had not. I am trying it now but the syntax isn't quite right. In your suggestion fred and endDate are smartvalues.

I get ...

unable to render smart values...

Like Susan Waldrip likes this
Jack Brickey
Community Champion
May 14, 2025

I got the following syntax to pass but it still does not compare as I would expect.

IMG_5724.png

Like Susan Waldrip likes this
2 votes
Jack Brickey
Community Champion
May 14, 2025

Ok so indeed it has to do with the date. I tested if {{fred}} is less than {{endDate}} and it succeeded. So I just need to recall how to ignore the time component I think as that is not important in my compare.

1 vote
Susan Waldrip
Community Champion
May 14, 2025

Hi @Jack Brickey , could you use {{fred}}=={{now.format("dd/MM/yyyy")}} instead of {{fred}}== {{now().jiraDate}} to leave out the time?

Jack Brickey
Community Champion
May 14, 2025

Will give it a go... and let you know.

Like Susan Waldrip likes this
Jack Brickey
Community Champion
May 14, 2025

No immediate luck. I have some other ideas that I'm going to try, but need to move onto some other things at the moment.

Like Susan Waldrip likes this

Suggest an answer

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

Atlassian Community Events