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:
https://answers.atlassian.com/questions/66094/preserving-original-estimate
Once answered, I hit up Atlassian since I thought I ran across a bug:
https://support.atlassian.com/browse/JSP-131174
Synopsis
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:
For the love, HELP! :)
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.setLevel(org.apache.log4j.Level.WARN) 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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: 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.
Let us know if there is anything else we can help you with.
Cheers,
Boris Berenberg
Atlassian Support - San Francisco
Enjoyed the support?! Tweet us! #atlassiansupport
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.