Hello,
Ive made a POC where we have an issue type and sub-tasks. The design is that when a new Event is logged we will have the subtasks auto-generated for the event manager.
Based on a select list choice, the issue transitions from Open to In-Progress and generates a specific set of subtasks.
The setup is working perfectly to create the subtasks on transition and with the POC using the ScriptRunner "Fast Track transition an issue" post function after the create event in the create transtion it worked as intended
I need to have 32 different transitions, so a bit of a pain to build with fast-track post functions and maintain, so i wrote a script.
Placing the script after the event, yields nothing, yet there are no errors in script. Im hoping Im just missing something small
here is the simplified version, thanks for any assistance:
///////
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.option.Option
//field id
long fieldId = 13847L;
//map of Select list value to Transition ID
Map typeMap = [
"List Option 1": 151,
"List Option 2": 81,
"List Option 3": 61
];
def customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField field = customFieldManager.getCustomFieldObject(fieldId);
Option fieldOpt = issue.getCustomFieldValue(field) as Option;
def fieldVal = fieldOpt.getValue() as String;
def transitionID = typeMap[fieldVal];
issue.transition(transitionID);