- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 05:50 AM
I am looking to setup a Business Rule that will set the incident state to 'Closed' when all Incident_task states are Closed complete .
Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 06:19 AM
Hello,
You will need to write an after business rule on the incident_task table with condition as
State changes to Closed Complete and Script as
var inc = new GlideRecord("incident_task");
inc.addEncodedQuery('state!=3^parent='+current.parent);
inc.query();
if (!inc.hasNext()){
var incident = new GlideRecord('incident');
if(incident.get(current.parent)){
incident.state = 7; //Replace your closed state value
incident.close_code = 'Solved (Permanently)'; //Replace your close code value
incident.close_notes = "Test notes";
incident.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 05:57 AM
Hi,
have a look at the solution provided to the discussion below, it will fit your need:
Set Incident Task to Resolved after all tasks are closed
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 06:19 AM
Hello,
You will need to write an after business rule on the incident_task table with condition as
State changes to Closed Complete and Script as
var inc = new GlideRecord("incident_task");
inc.addEncodedQuery('state!=3^parent='+current.parent);
inc.query();
if (!inc.hasNext()){
var incident = new GlideRecord('incident');
if(incident.get(current.parent)){
incident.state = 7; //Replace your closed state value
incident.close_code = 'Solved (Permanently)'; //Replace your close code value
incident.close_notes = "Test notes";
incident.update();
}
}