How to Remove Admin Access for Multiple Users in Contact Roles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Everyone,
There is a field in the contacts section called Contact Role under an Account, which defines roles for specific contacts. One of our customers has requested the removal of Admin access from this field in bulk.
I am able to remove the access individually using the Admin role; however, the request involves several hundred users.
Could you please provide guidance or assistance on how this can be completed in a single operation?
Thank you for your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @RohitDhiman , To fulfil the requirement you can use to update the records in bulk using the background script or run a fixed script to update all the records, make sure it won't impact other things in the instance.
here's an example script -
var gr = new GlideRecord("yourtable");
gr.addQuery("adminRoleUser");
gr.query();
while (gr.next()) {
gr.u_contact_role = "enterRoleYouWantToKeep"; //remove admin
gr.update();
}
Add some logs if needed.
If this solution helped you Please Mark this solution as accepted and helpful as it will be helpful for other users as well.
Best Regards.
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
What is the data type of custom field contact role ?
If it is a string field, try below. Assumption of string data type is based on your screenshot as it does not look like a reference or list.
Get Row Count
var acc_csm=new GlideRecord('customer_account');
acc_csm.addQuery('u_contact_role','contact_admin');
acc_csm.query();
gs.info(acc_csm.getRowCount());
Update the Role
var acc_csm=new GlideRecord('customer_account');
acc_csm.addQuery('u_contact_role','contact_admin');
acc_csm.query();
while(acc_csm.next())
{
acc_csm.u_contact_role='';
acc_csm.update();
}
If it is a reference or List, update the background script accordingly.
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan