Estimate time not updated


we wrote a script for updating original estimate field (under time tracking) using the setOriginalEstimate() function.

when we execute the script the field is updated but after we hit the refresh button for a few time the data is disappear and the data is set to zero( '0')

what may cause this?



2 answers

I think it depends on what your script is.

I guess it is a scripted field? If yes, Note that this field is NOT static. It will re-evaluate its own value again everytime it is displayed. So there is a possibility that the value will not be the same as before. If no, Let us know what your script looks like so maybe we can help.

Hi Gabrielle 

It is indeed a scripted field but the data seems to change even though the issues data remain unchanged


What does your scripted field looks like?

You can't set values on the issue in a script field... you should do this using a listener. Maybe you can explain the use case a little bit more?

Hi, We want to sum up original & remaining estimation as well as time spent from subtasks and set the values to their parent's Epic . in order to do that, we are calling two JQL querys. Here is the full script: import import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.web.bean.PagerFilter import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.event.issue.IssueEvent def componentManager = ComponentManager.getInstance() def issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-52")// without this line, the script return errors for the last 5 rows and with it the script works for the specified key def x = issue.getKey() def jqlQuery = '"Epic Link" =' +x def original=0; def spent=0; def remaining = 0; getFilterResult (jqlQuery,log).each{ Issue Foundstory -> def jqlQuery2 = '"Parent" =' +Foundstory.getKey() getFilterResult (jqlQuery2,log).each{ Issue Foundissue -> if(Foundissue.getOriginalEstimate()!=null){ original = original + Foundissue.getOriginalEstimate(); } if(Foundissue.timeSpent!=null){ spent = spent + Foundissue.timeSpent; } if(Foundissue.getEstimate()!=null){ remaining = remaining + Foundissue.getEstimate(); } }} def usera = ComponentAccessor.getUserUtil().getUserByName("Pazg"); List<Issue> getFilterResult(String jqlSearch, log) { def searchService = ComponentAccessor.getComponent(SearchService.class); def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() List<Issue> issues = null def parseResult = searchService.parseQuery(user, jqlSearch); if (parseResult.isValid()) { def searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter()) issues = searchResult.issues } } long orig=original.longValue() long spt=spent.longValue() long remain=remaining.longValue() issue.setOriginalEstimate(orig) issue.timeSpent = spt; issue.setEstimate(remain); ComponentAccessor.getIssueManager().updateIssue(usera, issue, EventDispatchOption.ISSUE_UPDATED, false) return null;

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


204 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you