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

GlideFather
Tera Patron

Hi @Udhayakumar_30,

probably not the solution but what's the first condition for?

 

There are 3 Change Types and your condition is checking if it is one of them, is there a chance that this will be evaluated false? The Type condition could be skipped...

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */