Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Remove members from group automation not working only for HR role

nupurgoswam
Giga Contributor

Subject: Remove members from group automation not working only for HR role

Description: We have a catalog item for removing users from the SNOW group. This is a automated catalog which works however doesnt work if the user needs to be removed from the group contains any HR role. reviewed the Script Include responsible for removing members from AD groups. Upon testing via a background script, it worked correctly for groups not associated with any HR roles.
However, for groups containing HR roles, the script failed to execute—even in the background. After making a few modifications, the script worked successfully in the background script.
This led me to suspect that the issue might be related to cross-scope restrictions. To address this, I created a script include within the HR scope. The idea is that when a group removal request involves HR roles, it will be handled within the HR scope itself, which may resolve the issue. We've made a few changes to the workflow and backend code. The request appears to be working now but only if I approve or my team approves the request. The automation still doesn't work if any other user approves.

Steps to reproduce:
Steps to Reproduce

Navigate to the Catalog Item for removing users from a ServiceNow group

Submit a request to remove a user from a group that contains any HR role.
Approve the request using a user outside your team (not you or your team members).
Observe that:

The automation fails to remove the user from the HR-related group.
The workflow is close complete but users are still not removed


Test the same request by approving it as you or your team.
Observe that: The request works correctly and the user is removed from the HR-related group.
Review the Script Include responsible for removing members from AD groups:
Works only if approved by me or my team
Still fails if approvals is given by other users.

 

 

Please suggest

0 REPLIES 0