Hi,
I have written the following code to change the "Original Value" field.
IssueManager issueManager = ComponentAccessor.getIssueManager()
MutableIssue issue = issueManager.getIssueObject("TASKTEST-313")
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
Long val = 3600 * 4
issue.setOriginalEstimate(val)
issueManager.updateIssue(user,issue, EventDispatchOption.ISSUE_UPDATED,false)
The code above works fine before any worklog entry is entered. However, after the first worklog entry has been entered, the value of "Original Estimate" is not changed by running the code above although it is possible to change the value of "Original Estimate" via the GUI Edit dialog window
Selezione_057.png
What am I missing?
Additional Information
I am able to change the value of "Original Estimate" by using the method store() of MutableIssue which is however deprecated so I would prefer not to use it.
IssueManager issueManager = ComponentAccessor.getIssueManager()
MutableIssue issue = issueManager.getIssueObject("TASKTEST-314")
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
Long val = 3600 * 4
issue.setOriginalEstimate(val)
issue.store()
Further Information
I am also able to change the "Original Estimate" value by using IssueService as below. However, I cannot yet understand why IssueManager.update does not work.
IssueManager issueManager = ComponentAccessor.getIssueManager()
MutableIssue issue = issueManager.getIssueObject("TASKTEST-314")
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
IssueService issueService = ComponentAccessor.getIssueService()
Long val = 3600 * 4
IssueInputParameters inputParameters = issueService.newIssueInputParameters()
inputParameters.setOriginalEstimate((Long)(val/60))
IssueService.UpdateValidationResult validationResult = issueService.validateUpdate(user,issue.id,inputParameters)
issueService.update(user, validationResult)