Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

No signature of method: static com.atlassian.jira.issue.Issue.getEstimate()

Ben Rao April 30, 2018

The below code is from a Scripted field within our JIRA system (7.8.0)

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import groovy.xml.MarkupBuilder
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.config.SubTaskManager
import com.atlassian.jira.issue.MutableIssue

def componentManager = ComponentManager.getInstance()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()

def totalRemaining = 0
def totalOriginalEstimate = 0
def totalTimeSpent = 0
def calculated = 0
if(Issue.getEstimate())
totalRemaining += Issue.getEstimate()
if(Issue.getOriginalEstimate())
totalOriginalEstimate += Issue.getOriginalEstimate()
if(Issue.getTimeSpent())
totalTimeSpent+= Issue.getTimeSpent()


// Calculate all time spent on each subtask
SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager();
Collection subTasks = Issue.getSubTaskObjects()
if (subTaskManager.subTasksEnabled && !subTasks.empty) {
subTasks.each {
MutableIssue x = (MutableIssue) it
if(x.getTimeSpent())
totalTimeSpent+= x.getTimeSpent()
}
}

// write a message on Support Contract Status
def status = "Uncalculated"
def total = totalTimeSpent+totalRemaining
def percentage = 0
if(totalOriginalEstimate != 0)
percentage = (total/totalOriginalEstimate)
def intPercentage = (int)percentage*100
return intPercentage as Double  

 

We are then getting the below error:

 groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.issue.Issue.getEstimate() is applicable for argument types: () values: []

 

I cannot see why/where this error is coming from 

1 answer

1 accepted

1 vote
Answer accepted
Ivan Tovbin
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.
April 30, 2018

Hi Ben,

It should be:

issue.getEstimate()

and NOT:

Issue.getEstimate() 

The same goes for:

issue.getOriginalEstimate()

 and

issue.getTimeSpent()
Ben Rao May 1, 2018

Awesome! Thank you very much! 

Suggest an answer

Log in or Sign up to answer