How do I add a force refresh rule to this business rule after SetAbrtAction is true?

ChuanYanF
Tera Guru

Dear experts,

 

I am facing a problem where currently if I did not tick the value_certified box for metric data task, it will abort the action but it wont force a refresh rule to refresh the page, so user have to refresh the page manually to go back to the previous state, but in the loading page it shows that the task has moved forward to awaiting approval state. So if I want to make the page refresh or force reload the page after it has check and the message also appear after it refresh and remain back in the in progress state. How can i do so?

ChuanYanF_1-1749534696781.png

 

ChuanYanF_0-1749534638867.png

 

1 ACCEPTED SOLUTION

ChuanYanF
Tera Guru

Instead of modifying the Business Rule, I added a query in the UI Action for Request Approval button, where I defined as follow:

if (!current.value_certified) {
    gs.addErrorMessage("Please select the check box to certify and acknowledge that the information provided by you is accurate.");
    action.setAbortAction(true); // Stop the action from continuing
} else {
    current.setValue('state', 3);
    current.update();
    action.setRedirectURL(current); // Redirect to the same form
}

View solution in original post

7 REPLIES 7

palanikumar
Mega Sage

Try this command at the end:

action.setRedirectURL(current);

Thank you,
Palani

Hi Kumar,

I tried to add your solution into the script but it still have the same problem, any other approach we can try?

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

	var translatedErrorMsg = gs.getMessage('Please select the check box to certify and acknowledge that the information provided by you is accurate.');
	gs.addErrorMessage(translatedErrorMsg);
	current.setAbortAction(true);
	action.setRedirectURL(current);



})(current, previous);

Anil Nemmikanti
Giga Guru

Hi @ChuanYanF ,

Please include  "action.setReturnURL(current)"; at the end of the code.

Hi Anil,

I tried your way of approach but apparently it still has the same problem