Hi.
I am trying to create a scriptrunner post-function based on the presence of a certain label in a *custom* label field.
This is the condition that I have come up with based on other answers:
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.component.ComponentAccessor;
import com.atlassian.jira.issue.customfields.option.Option;
CustomFieldManager customFieldManager = (CustomFieldManager)ComponentAccessor.getCustomFieldManager()
CustomField custom_field = customFieldManager.getCustomFieldObjectByName( "myCustomLabelField" );
def my_labels = (List<Option>) issue.getCustomFieldValue(custom_field);
if (my_labels != null && my_labels.contains("myTriggeringValue")) {
return true
} else {
return false
}
... but it does not seem to trigger (but also does not throw an error). Has anyone ever done this before?