SetAbortAction is not working in BR
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:24 PM
I'm using this br but setabortaction is not working as it shows invalid update but shows the error message
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('incident');
gr.addQuery('state','!=','7').addCondition('parent_incident',current.sys_id);
gr.query();
if(gr.hasNext()){
gs.addErrorMessage("Please close child incidents.");
current.setAbortAction(true);
}
})(current, previous);
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:57 PM
Hello @nowitsvashu ,
Please give a try to the modified script below and see how it works for you,
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord('incident');
inc.addEncodedQuery('parent_incident=' + current.sys_id + '^state!=7');
inc.query();
if (inc.hasNext()) {
gs.addErrorMessage("Please close child incidents.");
current.setAbortAction(true);
}
})(current, previous);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks & Regards,
Aniket.