I have a datetime picker field called 'Event Started At' with ID 11726.
I want to define a smart value that will calculate the time between now and value of the above field.
In the automation, I added a Create Variable action:
Variable name: DTDuration
Smart value: {{now.diff(issue.customfield_11726).hours.abs}}
This works.
Later I have an Edit Issue action that inserts this variable value into a short text custom field, as a check:
DTD is '{{DTDuration}}'
The result is, as expected:
DTD is '123'
However, if I use this same variable to set a number custom field, the field value remains empty.
I tried to use {{DTDuration.format}}, but the field is still empty.
Any help is appreciated.
Thanks for the answers, but adding .asNumber does not fix the problem.
I have another project where a very similar automation works, so I have checked the differences.
This 2nd project also has the date/time CF Event Started At, ID=11726, which is set manually by the user, before the automation rule is triggered.
The automation rule is as follows (all are actions):
1. Edit another CF (type date/time picker) and set its value to {{now}}. This CF ID is 11544. Basically it's a placeholder to keep the value of now.
2. Re-fetch issue data
3. Create smart variable DTDUration using this formula - absolute time, in hours, time between the CF that holds the 'now' value and the CF of Event Started At:
{{issue.customfield_11544.diff(issue.customfield_11726).hours.abs}}
So it seems to me that even though the documentations shows that you can use now.diff(), it does not work. Put in other words, field_1.diff(field_2) works, but now.diff(field_2) does not.
Doc is here.
The next step for me would be to open a tech support ticket to Atlassian since if my theory is correct, it's either a bug in their code, or in the documentation.
Not sure about this as I have not tested, but could it be that the value is stored as text?? Have you tried using asnumber?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Amir Katz (Outseer) ,
try to convert the smart value/variable to a number with .asNumber
see the description in the link below:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Best
Stefan
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.