Вы не создали экземпляр Issue , чтобы обращаться к переменной issue.
Кроме того рекомендую делать проверки на NULL, так как ваше issue может и не иметь родительской задачи. И тоже самое касается customfield.
Рабочий пример ниже.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Logger
import static org.apache.log4j.Level.DEBUG
// define logger
def _logger = Logger.getLogger("LOGGER")
_logger.setLevel(DEBUG)
// issue
String subIssueKey = "TASKIT-249"
IssueManager issueManager = ComponentAccessor.getIssueManager()
Issue issue = issueManager.getIssueObject(subIssueKey)
_logger.debug("KEY: " + issue.getKey().toString())
if (issue.getParentObject() == null) {
_logger.debug("Issue: " + subIssueKey + " IS NOT subTask!")
throw new NullPointerException()
} else {
issue = issue.getParentObject()
_logger.debug("KEY: " + issue.getKey().toString())
}
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
String myCustomFieldCode = "customfield_10100"
CustomField myCustomField = customFieldManager.getCustomFieldObject(myCustomFieldCode)
if (myCustomField != null) {
String myCustomFieldValue = issue.getCustomFieldValue(myCustomField)
_logger.debug("Value: " + myCustomFieldValue)
} else {
_logger.debug("Field: " + myCustomFieldCode + " NOT FOUND!")
}