Issue in BR

Sagar Rd
Tera Contributor

I have created a new state as pending, and if a case changes from work in progess to closed, I have created a BR with set abortaction to put the state back to pending. Its updating the state to pending but making the case as state inactive which should not be happening. Please help me with suggestions.

 

Script used -- 

 

(function executeRule(current, previous /*null when async*/) {
 
gs.addInfoMessage('State cannot be changed from Ready to closed complete');
 
current.setAbortAction(true);
current.state = 999;
 
current.update();
 
// Add your code here
 
})(current, previous);

 

Thanks,

Mourya

5 REPLIES 5

Also worth noting that setAbortAction doesn't prevent further BRs from running, it just prevents insertion into the database.

You can use Script Tracer and debugging scripts (servicenow.com) to track what script is modifying the record