You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.