I will preface by saying I have little to no knowledge of scripts... But I am trying to create a script field that will return a text entry based on the text string in another custom field. Here is my code, which returns the "else" case every time:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def type = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Risk Type"))
if (type == "New Feature/Function") {
return "Integrated Testing (manual or auto)"
}
if (type == "Logic change") {
return "Ad Hoc Testing (manual or auto)"
}
if (type == "UI change") {
return "Ad Hoc Testing (manual or auto)"
}
if (type == "No functional change") {
return "No testing required"
}
else {
return ""
}