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

Sandeep Rajput
Tera Patron
Tera Patron

@Sagar Rd Since you didn't give the complete context, I am making a suggestion here based on the current context. You can try the following script and see if it works for you.

 

(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.active=true;
current.update();
 
// Add your code here
 
})(current, previous);

Sagar Rd
Tera Contributor

@Sandeep Rajput Thanks for your response. Instead of update the active field to true, I would like to know the issue what might have causing this issue. Please let me know if any need any information.

 

Thanks,

Mourya

Kieran Anson
Kilo Patron

What order is your BR? The OOB BR 'mark closed' runs at order 800 and will set the active field to false if the state is one of 3;4;7;202 (Closed Complete, Closed Incomplete, Cancelled)

@Kieran Anson Thanks for your response, My BR Order is 100.

Thanks,

Mourya