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

Amit Pandey
Kilo Sage

Hi @bankuru bhargav 

 

Please replace your script with the following one-

 

if (current.assignment_group != 'SYS_ID OF GROUP') {
            if (current.state == '6') { 
                current.state = previous.state; // Rollback state change
                current.setAbortAction(true);
                current.addErrorMessage("Only the 'Incident Management Group' can resolve incidents with priority P1 or P2.");
            }
        }