Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a simple script to validate if all users in a selected list are in a group?

Terry Shoemaker
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 5, 2015

A more desirable option would be to have the picker only present people from a specific group in the select list, but given this option is not available I need to validate the list of users that were selected to ensure they are all in a specific group. The following code doesn't work, but I hope it conveys what I'm trying to accomplish.

---

import com.atlassian.jira.component.ComponentAccessor

def checkfield = customfieldManager.getCustomFieldObjectByName("name of custom field");

boolean flag=true;

for(i=0;i<checkfield.size();i++)

{

flag = groupManager.isUserInGroup(checkfield[i].name, 'group_name');

if(flag==false)

{

break;

}

}

return flag

---

1 answer

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2015

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events