Hi there! I have a task to track when time spent by specific developer exceeds original estimate.
What I've done is created a custom field named "dev-total" using JCMF Calculated (scripted) Duration Field with formula:
employeeKey = issue.get("customfield_12116")?.key; worklogs = issue.get("worklog")?.findAll({it.authorKey == employeeKey }); return worklogs.sum(0, { it.timeSpent });
where customfield_12116 is a field where developer is assigned.
Field works perfectly fine.
Than I've created an automation rule with compare condition.
And it doesn't work. It performs even if time spent by a developer is less than original estimate.
What am I doing wrong?
Hello @Alexander Makarovsky
As a debugging step you should print each of those smart values into the rule Audit Log so that you can see if the values being compared are what you expect.
You can print information into the Audit Log using the Log action in the rule.
Nice! Thank you!
I've done it and it seems {{issue.originalestimate}} returns nothing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok, now I understand. It was a simple mistake, since smart value for Original estimate should be issue.timetracking.originalEstimate
Problem solved.
Thank you so much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill Hi! Unfortunately, what I've done above after you kind advice didn't resolve an issue. I've managed the syntax thing and now I have both fields in automation rule to show perfectly.
Still the rule performs even if logged time is less that original estimated. I'm afraid this is because of format difference showed below.
Would be thankful for ideas on how to edit Groovy formula to make my custom field return the value of logged hours in the same format as Original estimate.
On the screenshot is the task with 1 hour logged.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the smart values you are using when printing "estimate" and "log"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
estimate - {{issue.timetracking.originalEstimate}}, log - {{issue.fields.dev-total}}
Where dev-total is JCMF Calculated (scripted) Duration Field with formula:
employeeKey = issue.get("customfield_12116")?.key; worklogs = issue.get("worklog")?.findAll({it.authorKey == employeeKey }); return worklogs.sum(0, { it.timeSpent });
where customfield_12116 is a field where developer is assigned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't have a data center instance to try this, but what if you use originalEstimateSeconds instead of originalEstimate?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes!!! Couldn't imagine to solve this from such angle. Thank you so much!
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.