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:
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 :
Is there a way to use automation rules to achieve what I am looking for?
Will appreciate any guidance.
Thank you.
Why?
Jira automation can handle calculations, whay purchase an app if its not required.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
You are right, my assumption didn't work
This should work, to get the correct hours.
{{#=}}ABS((({{issue.originalEstimate}} - {{issue.timeSpent}})/3600)/ 8){{/}}h
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.