Forums

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

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

Amir Katz (Outseer)
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.
August 25, 2022

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
Amir Katz (Outseer)
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.
August 28, 2022

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.

1 vote
Lynne Ratcliffe
Contributor
August 25, 2022

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 Champion
August 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
AUG Leaders

Atlassian Community Events