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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,047
Community Members
 
Community Events
184
Community Groups

How to change "Original Estimate" field after the first worklog entry has been entered?

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)

2 answers

0 votes
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.
Dec 23, 2016

That's pretty normal, in my experience. IssueService is, by its own description, better suited to making sure all the magic happens.

This services methods will make sure that when dealing with Issue's that all of JIRA's business rules are enforced. This means that permissions and data validation will be checked, proper events will be fired, and notifications will be triggered.

 

I'm guessing that derived fields like remainingEstimate, and possibly even Original Estimate itself need some of that business logic sauce behind the scenes, at least in certain contexts.

0 votes
JamieA
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.
Dec 09, 2016

But it works using IssueService, so does it matter?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events