Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,197
Community Members
 
Community Events
168
Community Groups

Automation and Smart Values - Fails to write a number field with integer value

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.

3 answers

1 accepted

0 votes
Answer accepted

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?

1 vote
Stefan Salzl Community Leader Aug 25, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Atlassian Automation

Jira Automation: Sum Up Story Points Roundup (Initiatives -> Epics -> Story/Tasks -> Subtasks)

Hi Everyone, In this roundup we combine all the jira automation rules to sum up story points across different issue types. We start from the lowest level, summing up story points from sub-tasks t...

3,102 views 10 9
Read article

Atlassian Community Events