Hi there,
I have a custom field of Date picker type (Groomed Date) and can retrieve the value successfully as a variable and from smart value as well. However, when try to use the variable in DIFF function, it returns null.
Here is automation rule flow:
1. The first variable is mynowdate = {{now.jiraDate}}
Log value: mynowdate - 2024-04-30
2. the second variable mygroomdate = {{issue.customfield_21231.jiraDate}}.
Log value: groom date: 2024-04-01
3. The final compare in email body looks like this:
diff1 - {{now.jiraDate.diff(issue.customfield_21231.jiraDate).days}}
diff2 - {{"mynowdate".jiraDate.diff("mygroomdate").days}}
diff4 - {{mynowdate.jiraDate.diff(mygroomdate).days}}
All these 3 lines return null where custom field is Date picker type, however this works with another field of DateTime picker (Begin Date) and the line below does calculates the difference:
diff2 - {{now.diff(issue.Begin Date).days}}
Why automation returns null with Date picket field? What do I do wrong?
We use Jira Data Centre.
Hello @Anna
When you store your value in a variable, it is getting stored as text. And so when you do a diff on 2 variables, it is not giving you expected results, OTOH, in {{now.diff(issue.Begin Date).days}} you are directly referencing the date field.
so you either reference the fields directly like: {{now.diff(issue.customfield_21231).days}} OR
you convert your variables to Date and then do diff like: {{mynowdate.toDate.diff(mygroomdate.toDate).days}}
Hope it helps.
I spent a few days trying to figure out and did a lot of research on internet.
The last line worked for me - {{mynowdate.toDate.diff(mygroomdate.toDate).days}} and calculated difference as expected.
I will mark this as answered
Thank you so much!!!!
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.