Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Reference qualifier advance

tylerduren7
Tera Contributor

Create a catalog item withe following details:
Item name : Add User to a Group
Variables:
1. Please select the user. ( it should show list of all the active users so that we can select one )
2. Select the Group. ( it should be showing all the active groups where the user is not already member of it )

 

Please give me solution for this

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@tylerduren7 

do this

1) 1st variable add this reference qualifier -> active=true

2) add this in 2nd variable ref qualifier

javascript:'sys_idNOT IN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.firstVariable).getMyGroups());

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

16 REPLIES 16

Ankur Bawiskar
Tera Patron

@tylerduren7 

do this

1) 1st variable add this reference qualifier -> active=true

2) add this in 2nd variable ref qualifier

javascript:'sys_idNOT IN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.firstVariable).getMyGroups());

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It didn't work

@tylerduren7 

sorry but you didn't share what you tried and how the variables are configured.

share that for better help

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Sorry for that can you please refer this i did this