I am trying to use the below script to pull the value from one field and apply it to a single Group picker. I have seen this script in another discussion and it worked for them, but I am not sure why it is not working for me. I would like to add this script as a listener for whenever the ticket is updated. Is there any way to make the listener only trigger when a specific custom field is updated? Below is the script that is failing for me:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def groupManager = ComponentAccessor.getGroupManager()
def assignGroupField = customFieldManager.getCustomFieldObjectByName("Test Group")
def assignedGroupValue = customFieldManager.getCustomFieldObject("customfield_10601")
def assignableGroup = groupManager.getGroup(assignedGroupValue) //jira group
issue.setCustomFieldValue(assignGroupField, assignableGroup)In this instance, Custom Field 10601 is where the value is currently. This is an Insight Custom field. I need to take the text from that field, and apply it as a group in the field called "Test Group".
As part of this script, is there any way to add a component that manipulates the text before it adds it to Test Group? I was wondering if I could use the 'substringBefore' function to only utilize part of the text?