Prevent Incident Resolution When Tasks Are Still Open

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2015 01:58 PM
We have a need to provide the ability to create Incident Tasks for our Applications Team, as they often divide up work when addressing an incident. As discussed in many other incident task discussions, we've taken the advice given and extended the Task Table to create Incident Tasks. The applications team can now create Incident Tasks without issue; however, they are Resolving Incidents without closing their tasks. We would like to do a check to prevent this by displaying a message when they set the Incident state to Resolved if there are Open Tasks. Initially, we attempted to do this with a Business Rule, without scripting and just using a filter in the Business Rule. It appears this would work, if I was able to set When To Run with a Filter Condition on Incident when State changes to Resolved and select the Incident Task table and filter on Active or State = Open. Is this possible to execute a Business Rule on the Incident table and filter on both the Incident table and Incident Task table by dot walking? For some reason, I am unable to select the Incident Task table and fields. Thanks!
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2015 02:21 PM
Hi Greg,
Create a before update Business rule on the Incident table with the following script in the Advanced tab.
function onBefore(current, previous) {
var target = new GlideRecord('incident_task'); // table name for your Incident task
target.addQuery('incident', current.sys_id); //this is the field which will link Incident to Incident task
//search for open Incident tasks
target.addQuery('state', 1).addOrCondition('state', 2).addOrCondition('state', -5); // check for open Incident task - add/edit states integer values as appropriate
target.query();
if(target.hasNext()){
if ((current.incident_state == 4) || (incident.problem_state == 5)){
gs.addInfoMessage("You have open tasks which must be completed before this record can be closed");
current.setAbortAction(true);
}
}
}
This script will check for open Incident task when Incident is set to Resolved status.
Let me know if this helped.
Suraj Chauhan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 07:53 AM
Thank you for the feedback Suraj. While I am able to get it working using a script, I was hoping to avoid the script and simply use the Business Rule filter conditions available since Eureka. The issue is that I'm unable to dot walk to Incident Task table (extended from Task) to select the field in the filter and don't understand why.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 09:04 AM
even though there are filters, they dont always work just right.
i've found that using a script works better than those filters a lot of times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 09:22 AM
In the filter Conditions, while selecting a field, there would be a option at the last "Show related fields", select that and check if you are able to find your Incident task table there.
Let me know if this helped.
Suraj Chauhan