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.

Role restriction

keerthana10
Tera Contributor

The same person is unable to provide more than one approval on a single Change request. The person who implements a change is unable to provide an approval for it, using BR.

3 REPLIES 3

Kieran Anson
Kilo Patron

Hi,

Are you needing some support here? Can you clarify your ask? 

10+ Tips for writing a quality community question 

keerthana10
Tera Contributor

i have written BR for this requirement , but its not working?

code:

 var approvalRoles = ['approver1', 'approver2'];
    var assignedApprovers = [];
    for (var i = 0; i < approvalRoles.length; i++) {
        var approver = current[approvalRoles[i]].user;
         if (assignedApprovers.indexOf(approver) > -1) {
            gs.addErrorMessage("The same person cannot provide more than one approval on a single Change request. Please assign a unique approver to each approval role.");
             current.setAbortAction(true);
               break;
        } else {
            assignedApprovers.push(approver);
             }
    }

I'm still unclear on what you want to achieve. Please do read the following article on how to provide information so the community can best answer your question:

10+ Tips for writing a quality community question