logo

NJP

"Copy Groups/Roles from Another User" Tool

Import · Feb 14, 2021 · article

It's something I've been wanting to do for a while, but just never got around to it. Had to do some testing and make a User's permissions the same as another so I finally sat down and built it. The "Form link" UI Action allows users with the "user_admin" Role to give a User the same Role and Group membership as another. Appears on the User form.

image

image

Allows the user to select a User record that they want to copy the Group membership and Roles from. They have separate control over Groups and Roles. For Groups, they can select one of the following:

image

"Ignore" will not doing anything in regards to Group membership. "Add to missing ones only" will ensure the current User is in all of the Groups the selected User is in. The "Make the same as selected User" option will ensure the current User is in all of the Groups the selected User is in as well as remove the current User from Groups the selected User is not a member of.

Same goes for the options for Roles, just slightly different wording:

image

This adds flexibility so you can decide to just copy Groups/Roles individually or copy both at the same time.

There are four objects that go along with this tool - a UI Action to pop open the UI Page that does the work and ACL and ACL Role records to ensure only users with the "user_admin" Role can see the page.

I've attached the XML files so you can just import them into your instance. As always, try it out in your company's development instance first, or better yet, your own personal development instance.

View original source

https://www.servicenow.com/community/developer-blog/quot-copy-groups-roles-from-another-user-quot-tool/ba-p/2273273