Hi all,
I am trying to use a Scripted Field to return a list of various responses, based on particular field values. For example, if the field "App1 Action Required" has a value of "Yes," I want the phrase "App1 Admin" to be added to a list that returns as the scripted field value. This is the inline script, which is currently returning a java.lang.NullPointerException... help?!
//resources
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
def customFieldMgr = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
//define result
def result = []
//add the specific phrase "App1 Admin" to the list of results if the value of c.f. "App1 Action Required" equals "Yes"
def actionApp1 = customFieldMgr.getCustomFieldObjectByName("App1 Action Required")
def valueApp1 = issue.getCustomFieldValue(actionAptos).toString()
if (valueApp1 == "Yes") {
def printApp1 = "App1 Admin"
result.add(printApp1)
}
//add the specific phrase "App2 Admin" to the list of results if the value of c.f. "App2 Action Required" equals "Yes"
def actionApp2 = customFieldMgr.getCustomFieldObjectByName("App2 Action Required")
def valueApp2 = issue.getCustomFieldValue(actionADP).toString()
if (valueApp2 == "Yes") {
def printApp2 = "App2 Admin"
result.add(printApp2)
}
//print full list of results
result
Disclaimer: I am not very good at this..