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.

Restrict user to stop resolving the incident when priority is Critical/High

bankuru bhargav
Tera Contributor

Hi Team,

I'm Trying to stop user resolving the incident which contains priority is P1/P2 

Below I'm running the Before BR but its allowing the users to resolve the incident. 

1)When to Run

bankurubhargav_0-1710770938854.png

2)Script:

bankurubhargav_1-1710771025647.png

let me if any error in my code. only "Major incident management" group allow to resolve the priory P1/P2 incidents

6 REPLIES 6

Mohit Kaushik
Mega Sage
Mega Sage

In your code at line number 3, you need to modify it as below:

if(gs.getUser().isMemberOf('Major Incident Management')==false). This should solve the issue.

 

Please mark this as correct and helpful, if it solved your issue.

 

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi Mohit,

Thank for the update.

However, when user submit the Incidnet.

Can we Cleary the "Activates" which are being updated in the incident form?  

 

@bankuru bhargav 

I could not understand what you are asking here. Could you pls explain the line: "Can we Cleary the "Activates" which are being updated in the incident form?"

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Community Alums
Not applicable

Hi @bankuru bhargav ,

Try using below script :

if(!gs.getUser().isMemberOf(' Group sys_id')){

gs.addErrorMessage(‘Your message here’);
current.setAbortAction();

}