Abort the execution in business rule and refresh the record

Khanna Ji
Tera Guru

How to refresh the current record with values stored in the database after abort action?

gs.addErrorMessage('You are not allowed save the record.');
current.setAbortAction(true);
action.setRedirect(current);

above code is aborting the execution but not keeping the user selected data in the fields. I want to revert back to the previous data.

15 REPLIES 15

Hi Swathi,

Unless and until you reload the record it will still show the data given by user. once you reload the record the data vanishes and actual data for fields are fetched from database.

What is your requirement here?

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

After displaying an error message, record has to be refreshed.

 

My requirement is if a user is a member of group A should not be allowed to edit the incident.

Hi Swathi,

So showing error message; reloading the form i.e. record is your requirement.

If user is member of group A should not be allowed to edit incident. Then why not have ACL for this?

That would be the best approach.

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Swathi,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

ACL is not a good idea, it will lock down the fields or a record. I want to display error message to the user when he changes the form and data should move back to previous state which is not happening unless I manually refresh the form.