Emergency change BR is not working

Udhayakumar_30
Tera Contributor
When to run conditions:
 
-Udhayakumar_30_0-1755754626224.png

 

 
It is working for Normal and standard change ---- but not for emergency
 
 
(function executeRule(current, previous /*null when async*/ ) {

    var AGMember = false;
    var currentUser = gs.getUser();
    AGMember = currentUser.isMemberOf(current.assignment_group.getDisplayValue());
    if (!(current.requested_by == gs.getUserID() || AGMember || current.opened_by == gs.getUserID()||gs.hasRole('change_manager'))) {
        gs.addErrorMessage('should ');
        current.setAbortAction(true);
    } else {
        current.work_notes = ' cancelled.';
    }
    })(current, previous);
 
For emergency -"Action not authorised " is the error.  -Please help me why it is not working for emergency
 
Ui action cancel also I added the condition--
(gs.hasRole('change_manager')||gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())||current.opened_by == gs.getUserID()||current.requested_by == gs.getUserID()) && new ChangeFormUI(current).isCancelAvailable();
10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@Udhayakumar_30 

what's your business requirement?

is the BR itself not triggering?

what is that BR doing? I could see it's just setting the work notes.

Then why not set it via UI action itself?

-> Is this OOTB UI action?

-> If it's Custom then ensure you give unique action name for this UI action

-> 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

1.what's your business requirement?

Requirement is  "opened_by" ,"requested_by",  ",member of assignment group" and the user having "change_manager" role able to cancel the change.

 

2.is the BR itself not triggering?

BR is triggering ,but only for emergency change it is not working --stating  error "action not authorized.

 

3. Is this OOTB UI action?

yes it is OOTB and i have added it in the OOTB those conditions.

 

It is working as fine for normal and standrad , but not for emergency . I have checked "transition condition"nothing has been added in emergency.

 

I have one display business Rule--that is used in "on change" client script -that is working as expected.

Pls help me in this !

 

 

 

 

@Udhayakumar_30 

the BR is only adding work notes.

Why not add that logic in UI action itself and BR is not required since you already updated the OOTB UI action?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

UI action they don't want to change. I'm reverting back handling only via BR-

 

if (!(current.requested_by == gs.getUserID() || isAGMember || current.opened_by == gs.getUserID()||gs.hasRole('change_manager'))) {

        gs.addErrorMessage('An change can only be cancelled by a member of the Assignment group,opened_by, requested_by. ');

        current.setAborAction(true);

 

If they are not the "requested by user or openedby user or AG member and has role change manager. it will terminate the action or if they are part of any of this "work note" added...It is working as expected for normal and standard.  but nor for emergency

Is emergency has any special condition or what should check?