I'm working on updating this script but am running into the following error if i try to use this as part of my resolve screen. Any tips on how to debug it?
Image 133.png
import com.opensymphony.workflow.InvalidInputException;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager;
import com.atlassian.jira.issue.fields.layout.field.FieldConfigurationScheme;
def report_error(String field, String message) {
if (! invalidInputException) {
invalidInputException = new InvalidInputException("The fields marked below must be filled for issues with resolution of \"${issue.getResolution().getName()}\"")
}
invalidInputException.addError(field, message)
}
def requiredResolution = issue.getResolution().getName() in ['Fixed', 'Done', 'Resolved']
//Issue Type Variables
def isADefect = issue.issueType.name == "Defect"
def notAnEpic = issue.issueType.name != "Epic"
def notAtask = issue.issueType.name != "Task"
def notASubtask = ! (issue.issueType.name in ['Development', 'Story Defect', 'Sub-task'])
//CustomField Manager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//Custom Fields
def isThisIssueA = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_15136"))
def storyPoints = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_17630"))
def testEvidence = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_14030"))
def acceptanceCriteria = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10737"))
def testerField = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_12532"))
def rootCause = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_14931"))
def risk = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_12937"))
if (notASubtask && requiredResolution){
if (notAtask){
if ( ! testEvidence && notAnEpic ) {
report_error("customfield_14030", "Test Evidence field is required")
}
if ( ! acceptanceCriteria && notAnEpic ) {
report_error("customfield_10737", "Acceptance Criteria field is required")
}
if ( ! testerField && notAnEpic ) {
report_error("customfield_12532", "You must specify the tester for this issue")
}
if ( ! issue.fixVersions ) {
report_error("fixVersions", "Fix Version/s field is required")
}
}
if ( ! issue.assignee ) {
report_error("assignee", "Assignee field is required")
}
if ( ! storyPoints && storyPoints != 0 && notAnEpic ) {
report_error("customfield_10033", "Story Points field is required")
}
if ( ! isThisIssueA ) {
report_error("customfield_15136", "You must specify what type of an issue this is")
}
}