- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 01:56 AM - edited ‎05-20-2025 03:31 AM
Hi All,
I am looking for a way to prevent an incident from being closed if there are activities still open on the playbook.
In this Incident I have activities still open that I want to ensure the SD follow. As you can see I am able to resolve this incident whilst these remain open. I have not found a way to prevent the incident from being closed. I did ask my good friend co-pilot which did provide a business rule to create but I have not had much success with it.
BR:
Has anyone been able to achieve this ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 12:56 AM
Update: I now have this working using the following BR for anyone else trying to achieve the same result.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord('sys_pd_context'); // Replace with your actual table name
gr.addQuery('input_table', 'incident');
gr.addQuery('input_record', current.sys_id);
gr.addQuery('state', '!=', 'Complete'); // Adjust based on your state values
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage('Cannot close the incident while there are open playbook activities.');
current.setAbortAction(true);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 03:29 AM
Hi @AdamShiner
only having the script is not enough to understand whether you BR is working or not. How have you configured the BR?
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2025 03:32 AM
Update the post with the BR, apologies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 12:56 AM
Update: I now have this working using the following BR for anyone else trying to achieve the same result.
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord('sys_pd_context'); // Replace with your actual table name
gr.addQuery('input_table', 'incident');
gr.addQuery('input_record', current.sys_id);
gr.addQuery('state', '!=', 'Complete'); // Adjust based on your state values
gr.query();
if (gr.hasNext()) {
gs.addErrorMessage('Cannot close the incident while there are open playbook activities.');
current.setAbortAction(true);
}
})(current, previous);