Abort the execution in business rule and refresh the record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2018 12:46 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 07:07 AM
Hi Swathi,
Displaying error message is fine but showing the data which is previous one before user changing the data is not possible without reloading the form. This is a fact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 08:27 AM
Are you sure? Then what is the meaning of previous and current? why Its not working for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 09:15 AM
Hi Swathi,
current and previous would work in business rule. How are you using it in your scenario and how do you think it would help you to show the previous values without the form being refreshed?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2018 05:56 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 05:06 AM
Its a fact that unless you reload the form, you won't see previous values on form if Before business rules is running even after aborting the action using current.setAbortAction(true). But another fact is that new values shown are just virtual and not submitted to database since you have aborted the update action.
Reload the form manually to see previous(database) values. If you don't want to reload the form then use below code in your before business rule-
current.setAbortAction(true);
current.state=previous.state;
current.category=previous.category;
Even this action is not triggering any update action on database sever since previous and current values are same. So cheers.