Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Updating the remaining estimate set the original estimate as well

Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2016

Hi 
we have script that set the original estimate to '0' under certain conditions.
We also like this to reflect it in the history and in the agile board (burndown)
for some reason it seems that the remaining estimation update event affect the original estimation as well and we see in the issue history that the original estimate was set to '0' as well (although the actual original estimate is not zero) and it messed up our burndown chart
any idea how can we fix this?

we use the following script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.issue.UpdateIssueRequest;
def x=5
if(x='5'){ 										
	MutableIssue issue=issue
	Long remain=0 
	issue.setEstimate(remain)
	IssueEvent event;
    def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
	ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false);
}

thanks

DaractualData.PNGzeroRemainHistory.PNG

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2016

In order to make sure JIRA's business logic is followed, you really ought to use the IssueService to update the issue, rather than the IssueManager. See https://answers.atlassian.com/questions/261412 for an example of something very similar. You'd want to do most of what they did, only instead of using the validateTransition and transition methods to move an issue through a workflow, you should use validateUpdate and update.

Also, instead of using setEstimate, you should use setRemainingEstimate on the IssueInputParameters. 

Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2016

Works great!!

thanks a lot Jonny!

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2016

I think it's the setting of your estimate to 0 that may be messing up the charts.  The point of an estimate is that you make it and measure the difference between estimate and actual later.  As you're destroying the estimate, there's nothing it can do.

Dar Kronenblum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2016

Hi Nic,

not sure what you mean- what different does it makes if the user set the remaining to zero or that it done by script?

actually the remaining setting to zero reflect great in the chart is the side affect that fire event that the original estimate was set to zero as well (which it didn't actually) that mess it up

is there a way to set the remaining without affecting the original?

thanks

Dar

TAGS
AUG Leaders

Atlassian Community Events