Hi all.
In our jira server instance, we need to set remaining estimate to 0 when an issue is resolved. I’ve been trying to reset it through two ways:
Issue issue = issueEvent.getIssue();
IssueManager issueManager = ComponentAccessor.getIssueManager();
MutableIssue mIssue = issueManager.getIssueObject(issue.getKey());
mIssue.setEstimate(0L);
issueManager.updateIssue(user, mIssue, EventDispatchOption.ISSUE_ASSIGNED, false);
and
Issue issue = issueEvent.getIssue();
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.setRemainingEstimate(0L);
IssueService.UpdateValidationResult validateUpdateResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters);
if(validateUpdateResult.isValid()) {
IssueService.IssueResult updateResult = issueService.update(user, validateUpdateResult);
if (!updateResult.isValid()) {
log.debug("the issue update failed");
}
}
Both ways seem to work when you check the issue Activity>History tab, but they don’t update the TimeTracking section. In fact after checking the database, I can confirm that the update didn’t change the remaining estimate.
Can someone help??
Thank you!