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
Hi Ben,
It should be:
issue.getEstimate()
and NOT:
Issue.getEstimate()
The same goes for:
issue.getOriginalEstimate()
and
issue.getTimeSpent()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.