Forums

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

Need help with plusHours Automation

Devarajan Mani
Contributor
August 10, 2024

I have created a variable as below

 

Screenshot_11-8-2024_112.jpeg

 

Then when I wrote a smart value expression to update Date and Time field with the duartion field as 5 

{{issue.AT Start Date.plusHours(duration)}}

But it is not updating the Date and time field. Can anyone suggest what is wrong?

Regards,

Dev

2 answers

0 votes
Bill Sheboy
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 11, 2024

Hi @Devarajan Mani 

First, created variables are text / string types: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable

When you want to use them as a number they must be converted, such as with the asNumber function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#asNumber

For example: 

{{issue.AT Start Date.plusHours(duration.asNumber)}}

 

Next, you appear to have a field named Duration and then you are creating a variable with the same name.  Why do that rather than just using the field?

 

Next, you are referencing a field apparently named "AT Start Date".  Smart values for fields are name, spacing, and case-sensitive...and, sometimes the smart value does not exactly match the field display name on the Jira views.  When an incorrect smart value is used, it evaluates to null

Please use this how-to article to confirm you have the correct smart value for your field: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Finally, when using created variables, I recommend always adding adding a prefix to avoid confusion with any field names.  For example, using the name varDuration instead of duration.

 

Kind regards,
Bill

0 votes
John Funk
Community Champion
August 11, 2024

Hi Devarajan,

Just put duration inside curly brackets (but leave the parentheses also). 

({{duration}})

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events