Business rule to Only allow specific users to add role admin or security_admin to users and groups

sanjana5
Tera Contributor

Create a before insert business rule that checks will check to see if the logged in user is attempting to insert the role of admin or security_admin into a record on the sys_user table or sys_user_group table. If so the logged in user must be one of the following

SONALI(S12365)
PHANI(P67543)
PRIYA(P6539)

If not abort the action and display a message "You are not authorized to perform this action. If you need to provide admin or security admin access to a user you must submit the following request in the ServiceNow Production instance

 

1 ACCEPTED SOLUTION

Ok. So you will have to create an onInsert Before Business rule in the sys_user_has_role table. I should be pretty simple.

In the BR condition, you can specify the roles, for ex, Role = admin OR Role = security_admin && User!=SONALI && User!=Phani && User!=PRIYA

And in the 2nd Tab 'Set Values', you can select action to Abort with the abort message.


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

7 REPLIES 7

SanjivMeher
Kilo Patron
Kilo Patron

Is this a question?


Please mark this response as correct or helpful if it assisted you with your question.

Hi sanjiv, yes it is a question to create a before insert business rule

 

Ok. So you will have to create an onInsert Before Business rule in the sys_user_has_role table. I should be pretty simple.

In the BR condition, you can specify the roles, for ex, Role = admin OR Role = security_admin && User!=SONALI && User!=Phani && User!=PRIYA

And in the 2nd Tab 'Set Values', you can select action to Abort with the abort message.


Please mark this response as correct or helpful if it assisted you with your question.

sanjana5_0-1665730417353.png

sanjana5_1-1665730443487.png

Correct me if i'm wrong. Thanks in Advance