Hi everyone
I have a custom field, which offers users one of five options. When they choose one of these options, I map their choices to the names of notification groups in another custom field. The idea is that I use this custom field to send emails to the groups, but I can't fire an event because it is only a text box, not a group picker.
When I try to use the script to update a group picker, I get errors informing me I can't update the group field with string.
I am using this script so far:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.MutableIssue;
MutableIssue issueToUpdate = (MutableIssue) issue;
// create the map of Change Area names to approval groups
def approvalGroupMap = [
"Option1" : "tech-approval-group1",
"Option2" : "tech-approval-group2",
"Option3" : "tech-approval-group3",
"Option4" : "tech-approval-group4",
"Option5" : "tech-approval-group5"
];
// get the change area value
def changeAreaFieldObject = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_15502");
def changeArea = issue.getCustomFieldValue(changeAreaFieldObject).toString();
def group = approvalGroupMap[changeArea];
// return the newly set field value to confirm
return group
This code lets me get the scripted field the name of the right mapped group, but I fail to then update the group picker with this result in the same script. Any ideas how I do this with scriptrunner?