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-26-2022 03:45 AM
Senario :- If the record with same short description is created then abort the operation.
We can do this senario with after business rule as
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('incident');
gr.addQuery('short_description', current.short_description);
gr.query();
if (gr.next()) {
current.setAbortAction(true);
gs.addErrorMessage("duplicate value inserted");
}
})(current, previous);
This will help to validate if same short description is created it will abort the action and send the error message.