Forums

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

Time tracking using automation rules

Kenisha Naidoo July 21, 2025

Good day, 

I have a user who requested for a custom field Effort Variance. This field is essentially subtracting Time Spent (sys field) from Original Estimate (sys field). I am trying to use an automation rule instead of scriptrunner, I just want to see if its possible. The rule runs , but it always shows in a negative, even when its within the estimate. My rule is like this:
Rule.png

The action is to edit the Effort Variance field when the criteria is met. I tried using this expression:
{{#=}}({{issue.originalEstimate}} - {{issue.timeSpent}})/3600/8{{/}}d {{#=}}((({{issue.originalEstimate}} - {{issue.timeSpent}})/3600) % 8){{/}}h {{#=}}((( {{issue.originalEstimate}} - {{issue.timeSpent}}) % 3600) / 60){{/}}m

But this still gives me a negative even when the original estimate was set for 5w. The result needs to be something like 2w 3d 4h. See below eg :
Snap 1.png
Is there a way to use automation rules to achieve what I am looking for?

Will appreciate any guidance.

Thank you.

2 answers

0 votes
Tinker Fadoua
Community Champion
July 21, 2025

@Kenisha Naidoo 

You will have better luck with ScriptRunner.

Best,

Fadoua

Marc - Devoteam
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.
July 22, 2025

@Tinker Fadoua 

Why?

Jira automation can handle calculations, whay purchase an app if its not required.

0 votes
Marc - Devoteam
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.
July 21, 2025

Hi @Kenisha Naidoo 

You need to adjust your smart values in the rule.

See, jira-smart-values-math-expressions 

Example, based on your information.

{{#=}}({{issue.originalEstimate}} - {{issue.timeSpent}})/3600/8.abs{{/}}d

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.
July 21, 2025

Hi @Marc - Devoteam 

Have you tested that expression?

My understanding is the absolute value function has two possible formats, both of which differ from what you show:

inline: {{myNumberValue.abs}}

long-format with math expression: {{#=}}ABS({{myNumberValue}}){{/}}

 

Kind regards,
Bill

Like # people like this
Marc - Devoteam
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.
July 22, 2025

Hi @Bill Sheboy 

You are right, my assumption didn't work

@Kenisha Naidoo 

This should work, to get the correct hours.

 {{#=}}ABS((({{issue.originalEstimate}} - {{issue.timeSpent}})/3600)/ 8){{/}}h 

Suggest an answer

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

Atlassian Community Events