Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

HowTo: change Group Picker (multiple groups) with scriptrunner / post-function

Tim S_ June 12, 2017

Hi,

I try to set an MultiGroupPicker custom field with multiple groups. The setting with 'setCustomFieldValue' works fine.

...
List<Group> accessGroups = (List<Group>) mutableIssue.getCustomFieldValue(multiGroupCf);
if(accessGroups != null)
{
  accessGroups.add(groupManager.getGroupObject(it));
  //set custom field
  mutableIssue.setCustomFieldValue(multiGroupCf, [accessGroups]);
}
...

 But if I update the issue with

    ComponentAccessor.getIssueManager().updateIssue(currentUser, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false);

I get the following error

...
java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.atlassian.crowd.embedded.api.Group
...

 

Maybe someone can help me with this problem.

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Tim S_ June 13, 2017

I found it. The bracktes were to much:

mutableIssue.setCustomFieldValue(multiGroupCf, accessGroups);

 

TAGS
AUG Leaders

Atlassian Community Events