Copy the value of aggregate original estimate to a custom field at a specific place in the workflow. My intention is to use groovyrunner plugin's "Script Post Function" ability to obtain and copy the value into my custom field called Locked Estimate (cf). Looking at the API at http://docs.atlassian.com/software/jira/docs/api/latest/, I see this is how I obtain aggregate original estimate:
I wish I didn't have to restort to JS to solve this problem, but I found out from Atlassian that getting the data from aggregate original estimate was more involved than a copy from one cell to another via a post function.
In Atlassian's words:
I am sorry but the Original Estimate field does not simply store a numeric value and thus can not be copied out. I would recommend that you just ask your users to enter it twice. If you would like a cleaner solution than you may need a custom plugin to accomplish this. You can look into our API at: https://confluence.atlassian.com/display/JIRA/API+Documentation or you can get in touch with an Atlassian Expert: http://www.atlassian.com/resources/experts/ that may be able to assist you. Unfortunetly, custom plugins are outside of the Atlassian Support Offerings (http://www.atlassian.com/resources/experts/) and we can not assist you with developing this.
i took a few hours to dust off the programming skills. i'm sorely out of practice, and this undoubtedly could be optimized. nonetheless, it does the trick.
// constructing objects for getting AOE value
ComponentManager componentManager = ComponentManager.getInstance()
JiraAuthenticationContextImpl jac = componentManager.getJiraAuthenticationContext()
AggregateTimeTrackingCalculatorFactoryImpl attcfi =
(jac,new SearchProviderFactoryImpl(),new ThreadLocalCachingPermissionManager
IssueImplAggregateTimeTrackingCalculator iiattc = new IssueImplAggregateTimeTrackingCalculator
AggregateTimeTrackingBean bean = iiattc.getAggregates(issue)
AggregateOriginalEstimateSystemField aoesf = new AggregateOriginalEstimateSystemField
// constructing objects for getting/setting custom field Locked Estimate
CustomFieldImpl lockedEstimate = componentManager.getCustomFieldManager().
// finally calculating the answer
Long summedEstimate = aoesf.getAggregateDuration(bean)
summedEstimate == null ? summedEstimate = 0 : summedEstimate
issue,new ModifiedValue(lockedEstimate.getValue(issue),summedEstimate as Double),
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot