SetAbortAction is not working

nowitsvashu
Tera Guru

Hi, 

I've a issue in Before BR.

current.setAbortAction(true) is not working.

 

Suppose on incident i've created a befor br when incident state changes new to in progress then setabortaction will work. But when state changes new to inprogress it remains on the state of in progress and shows error of "invalid update" and on refreshing the page state auto changes to new.

I want setabort action doesn't change the state because when it reaches to the state then it trigger the Workflow and send approvals also impact the user experience.


7 REPLIES 7

That's why I mentioned 'If abort action is the main operation', or perhaps I Should have mentioned the ONLY operation 😉

Amit Pandey
Kilo Sage

Hi @nowitsvashu 

 

Please check this-

 

(function executeRule(current, previous /*null when async*/) {

    if (current.state == '2' && previous.state != '2') { // '2' represents the in progress state, adjust it according to your instance
        
        current.setAbortAction(true);
        current.state.setDisplayValue(previous.state.getDisplayValue());
    }
})(current, previous);

 

Please mark my answer helpful and correct.

 

Regards,

Amit

Gurupreet
Tera Contributor

Try Increasing the order of BR 

 

Please Mark helpful if it works for you