The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Jira Automation; setting variable with conditionals

Allan Conybeare
Contributor
April 7, 2025

Hi, 

I'm attempting to assign a variable, varHours using a condition that converts the original estimate value (seconds) to hours - 

 

{{issue.timetracking.originalEstimateSeconds.divide(3600)}}

This works ok except if the value is null, so have been attempting to have it default to 0, been trying a few things without success, think there is a div by zero error happening - 

{{issue.timetracking.originalEstimateSeconds.divide(3600).round(0).default(0)}} 

wondering if the best bet is the create a temp variable then use it to test for empty  

Wider background to what I'm doing. I have another field called T-shirt-size that I'm using automation to set when the Original Estimate is set or changed. It runs some conditionals based on the value in hours, to work out s,m,l, & xl.

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

6 votes
Answer accepted
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 Champions.
April 7, 2025

Hi @Allan Conybeare 

In my experience, the inline math operations do not consistently handle empty / null values well.  As an alternative, perhaps use the longer format expression and add a 0 default value at the front:

{{#=}} ROUND( 0{{issue.timetracking.originalEstimateSeconds}} / 3600, 0) {{/}}

I added a ROUND function but you could remove that if you want a fractional value result.

 

Kind regards,
Bill

Allan Conybeare
Contributor
April 7, 2025

Superb thanks Bill that has worked

Like Bill Sheboy likes this
TAGS
AUG Leaders

Atlassian Community Events