Remove users from a group

Rachael12
Tera Contributor

I have script which works fine to remove users from a group when an admin places a request but fails when ITIL/end user places a request.
In order to mitigate this, I have created a subflow and trying to call it from the workflow.

In the subflow, I am using the sys_grp_members to extract the group and user relationship. The subflow works fine for single user and removes it from the group but fails when there are multiple users.

Please suggest how to achieve for multiple users.

Also how to call a subflow from a workflow.

8 REPLIES 8

GlideFather
Tera Patron

Ahoy @Rachael12,

 

have you tried to see the flow execution? it's good source of details for debugging. In your flow there's "test" button in the top, go for it and select a request (can be used several times, no need to always create new test records) and it oculd give youe some insights...

_____
Answers generated by GlideFather. Check for accuracy.

Tanushree Maiti
Giga Patron

Hi @Rachael12 ,

 

Check  ACL role on your Delete ACL on  sys_grp_members  plus Write ACL on sys_user_group.

Definitely ITIL ( end user should not have this permission) user does not have this permission.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@Rachael12 

are you iterating a list collector variable?

share some more details

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

Hello Ankur,
Yes, users to remove is a list collector. 
1. I am fetching the group member records through group == 'group name'
2. Once I have the records, I am converting group members list from array to string.
3. Then, I am running for each item in 2, delete 

Issues: 1. It is comapring users' sysID with record sysID
2. Its only taking child0