How do I copy Aggregate Original Estimate to another field?

Below are two links that tell the whole story. Below that is a quick synopsis of what I want to do. Any help will be appreciated!

My original question:

Once answered, I hit up Atlassian since I thought I ran across a bug:


My goal is to copy the value of aggregate original estimate (AOE) from a new feature and save it to a custom field. I want to do so at a specified point in the workflow.

My avenues of approach thus far:

  • Use 'Misc Workflow Extension' plugin to copy AOE to a custom field of type numeric via a post function. Error. (See 2nd link for a screenshot.)
  • Use 'Misc Workflow Extension' plugin to copy AOE to a custom field of type Intervia (from KCF additional custom fields plugin) via a post function. Error. (Same as above.)
  • Search the answer boards to find someone doing the same. No results.
  • Search google to find someone doing the same. Nothing.
  • Cuss obsessively. Success!

For the love, HELP! :)

4 answers

1 accepted

2 votes
Accepted answer

Here's the code I created that I now use as a post-function and that copies the aggregate of original estimate to a custom field upon the proper workflow transition:


import com.atlassian.jira.ComponentManager
import org.apache.log4j.Category
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.event.type.EventDispatchOption


log.debug ("---- Start locked estimate ----")
Double myEstimate = 0
issue.getSubTaskObjects().each { task ->
	log.debug("our task: $task")
	def taskEstimate = task.getOriginalEstimate()
	if (taskEstimate != null) {
		myEstimate += task.getOriginalEstimate()
	log.debug("summed estimate: $myEstimate")

IssueManager issueManager = ComponentAccessor.getIssueManager()
UserManager userManager = ComponentAccessor.getUserManager()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField lockedEstimate = customFieldManager.getCustomFieldObjectByName("Locked Estimate")
MutableIssue myIssue = issue

myIssue.setCustomFieldValue(lockedEstimate, myEstimate)
issueManager.updateIssue(userManager.getUser("automation"), myIssue, EventDispatchOption.ISSUE_UPDATED, false)
log.debug ("---- End locked estimate ----")



Hello, Tanner, I have now the same problem. Could you please write me where your put this code above? Thanks a lot, Vladimir

I realized that I've cleaned up the code above so I've edited my answer with the latest. To use the script: 1. Install the Script Runner plugin. 2. Modify whatever workflow you wish to use the script in. 3. Go to post-function for the appropriate transition. 4. Add a new "Script Post-Function" post-function. 5. Copy and paste the above.

Hi Tanner, I was going through the same process you did at the start of this thread. When I started getting error messages and investigating I came across this. I have successfully implemented this in a test project and I see that your script gets the sub-tasks OE and gives the AOE. I am not a developer so was going to ask how could I add any time that was entered in the OE field of the parent issue? We are using a custom issue type called Project. Also what custom field type did you end up using? (i used a number field in my testing.) One other question was did you somehow restrict the ability to edit the Locked Estimate field after it was populated? Thanks Andrew

> how could I add any time that was entered in the OE field of the parent issue? 1. install the script runner plugin. 2. place the code above on your JIRA server. bear in mind it may need to be edited to some degree. (line 27 comes to mind.) 3. create a post-function at the proper transition that uses the code using "Script Post-Function" 4. ensure your screens contain the proper custom field so the new field is viewable. > what custom field type did you end up using? Interval Field > did you somehow restrict the ability to edit the Locked Estimate field after it was populated yes. this field is part of the view screen and is not part of the edit screen. as such, the only way it gets populated or changed is through the custom code we have.

Hi Tanner I have similar request- i want to copy value from custom field(number) to original estimate field, i am looking at above script, not sure which to modify, i see you have used "automation" as a user!! i want to put this script in transition, can you help me what to modify for my case, thanks for your help. Raju

the two values that you'll want to change are "automation" which is the user executing the code and "Locked Estimate" which is the custom field in which the summed estimate is stored. follow my 5 steps in a previous comment for how to implement this.

Tanner, thanks for quick update, yes i got those 2 fields, my case is other way round, i want to copy custom field to Original estimate, let me modify code and see, how it goes, thanks

ahh ... now i understand. that's a bit different but not substantially so. if you have questions, your best bet will be submitting them as questions on this site. the more specific, the more help the group can be. :)

I tried to look at your support ticket, but I was not able to. Please summarize the behavior you saw and any response from Atlassian.

My intent:
I want to preserve the original estimate of a feature at a point in time in the workflow. I planned to do so by copying the summation of the original estimate to a custom field during the appropriate transition. I provided several screen shots of much of what I describe below.

Steps to reproduce:
1. Create a custom field called Locked Estimate of type Number.*
2. Create a post function during the appropriate transition that copies summation of original estimate to locked estimate.
3. Publish this new workflow feature.
4. Create a feature with 0 hour estimate and a sub-task with 2 hour estimate.
5. Advance this feature through the post-function.

  • to ensure it wasn't some kind of field type conflict, i also tried copying the value from summation of original estimate to Time Spent on the post function. I got the same result as described below.

What I expected:
I expected the value would be preserved in Locked Estimate.

What actually happened:
I received an error. You'll see it as a screenshot.

atlassian's reply:

Hey Tanner,

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: or you can get in touch with an Atlassian Expert: that may be able to assist you. Unfortunetly, custom plugins are outside of the Atlassian Support Offerings ( and we can not assist you with developing this.

Let us know if there is anything else we can help you with.

Boris Berenberg
Atlassian Support - San Francisco
Enjoyed the support?! Tweet us! #atlassiansupport

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,397 views 15 19
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you