How to assign a role for very bulk users

Sri56
Tera Contributor

HI Team,

We are having 3lakhs+ users in our environment.

We have a requirement to give a role for all users.

What is the feasible/best practice way?

Please suggest.

Thanks,

Sri

5 REPLIES 5

Vaishnavi Lathk
Mega Sage
Mega Sage
Hello
To assign a role to a User, use the Application Navigator in the main ServiceNow browser window (not Studio) to open User Administration > Users. Open a User record from the list.
  1. Select the role to add from the Collection slushbucket
  2. Select the role to add by clicking it.
  3. Use the Add button
  4. Click the Save button.

as per the Best Practice:-

What SN says is if you want to assign particular set of people to give them roles , better create a group and add a role to that group. So all the members in that group will be inherited with the role.

Add Role

Hi If You want to Give Role to users of same company then they all should have same company field automatically.

so you can try this script:-

var gr = new GlideRecord("sys_user");

gr.addQuery('company', 'sys_id');// please add sys_id of the company

gr.query();

while(gr.next()) {

  if (gr.accumulated_roles.toString().indexOf(",us_users,") == -1) {

    gr.roles = gr.roles + ",us_users";

    gr.update();

}

Refer the Threads

Link

Please Mark Correct and Helpful

Thanks and Regards

Vaishnavi Lathkar