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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

set the original estimate and remaining estimate based on 2 fields

Jira 7.7.2 and Script runner plugin 5.5.0

Here is my requirement. I have DEV Estimate and BA Estimate custom fields. We needs to take total of these 2 fields and then update in original estimate.

I have written code in script listener and its updating original estimate and remaining estimate if DEV estimate and BA estimate change . So far good

But Its not working when user log the hour (log work) and then change DEV  or BA estimation. It should add both DEV and BA estimation values and then update in original estimation. whereas remaining hours getting update fine.


Here is my code. Please let me know whats wrong in my code.


package com.custom
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.IssueInputParameters
import org.apache.log4j.Category;

MutableIssue issue = event.issue as MutableIssue

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def orgEstDEV = customFieldManager.getCustomFieldObjectByName("Original Estimate DEV")
def orgEstDEV_Val = issue.getCustomFieldValue(orgEstDEV)
def orgEstBA = customFieldManager.getCustomFieldObjectByName("Original Estimate BA")
def orgEstBA_Val = issue.getCustomFieldValue(orgEstBA)

//log.debug "BA val = ${orgEstBA_Val}"

//long totalDEVBAEst = (((orgEstDEV_Val!=null) ? orgEstDEV_Val : 0) + ((orgEstBA_Val!=null) ? orgEstBA_Val : 0))

long totalDEVBAEst = orgEstDEV_Val + orgEstBA_Val

long origEstvalue = totalDEVBAEst * 3600
log.debug "Original est = ${origEstvalue}"

def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()

//Remaining hours
def TTSpent = issue.getTimeSpent();
if(TTSpent < 0 || TTSpent == "null" || TTSpent == ""){ //Keep the Remaining Estimate from going into a negative number
TTSpent = 0;

long REst = origEstvalue - TTSpent;

def IssueManager issueManager = ComponentAccessor.issueManager
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH ,false)

1 answer


We are having the same problem. JIRA Version: 7.9.2, Script Runner Version: 5.5.3

When there is no log work on the issue, the code below works fine, but this is not working when there is time logged on the issue.

issue.setOriginalEstimate(updatedEstimate as Long)
ComponentAccessor.getIssueManager().updateIssue(users, issue, EventDispatchOption.DO_NOT_DISPATCH,false);

 The code that updates even if work is logged on the issue, is when we use '' instead of 'ComponentAccessor.getIssueManager.updatedIssue(args) but this is deprecated. 

The code with the deprecated function is this:

issue.setOriginalEstimate(updatedEstimate as Long)


I also tried using IssueInputParameters, but this does not work either. I checked the Timetracking settings and  Legacy Mode is also disabled but still not working :(  

Any hints please on how this can be solved without using the deprecated function?

Hi @Omprakash Thamsetty  and @Cristina Gatt  did you ever get this to work ? 

Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you