when all child tickets are closed then the parent ticket should be closed automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-23-2022 04:32 AM
Hi,
when all child tickets are closed then the parent ticket should be closed automatically
Thanks
Akhil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-23-2022 04:54 AM
Hi,
Used Before Update BR with below filter condition
State Changes to Closed
In advance script try below logic
(function executeRule(current, previous /*null when async*/ ) {
var inc = new GlideRecord("incident");
inc.addQuery("parent_incident", current.sys_id); //how many child ticket assigned
inc.addQuery("state", "!=", 6); // Close state value
inc.query();
if (inc.getRowCount() > 0) {
gs.addErrorMessage("There are child ticket who are not yet Closed");
current.setAbortAction(true);
}
})(current, previous);
Please let us know if it helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-24-2022 10:25 AM
Hi Kalyani,
Thank you for your response.
I tried your script but is not working, when I closed the child ticket then the parent ticket is not closed. And, the parent ticket is in the same state, there is no change in the state.
Regards
Akhil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-25-2022 12:07 AM
Hi Akhil
Modified Br like below
When to run=> after Update
Filtered condition - State changes to closed and
parent incident not empty
In advance used below logic
(function executeRule(current, previous /*null when async*/ ) {
gs.addInfoMessage("BR Triggers");
var inc = new GlideRecord('incident');
inc.addQuery('parent_incident', current.parent_incident); // Records related to same parent
inc.addActiveQuery();
inc.query();
if (!inc.next()) {
gs.addInfoMessage("In Child BR-----");
var parInc = new GlideRecord('incident');
parInc.get(current.getValue('parent_incident'));
parInc.state = 7; // Close the incident
parInc.close_code = 'Solved (Permanently)';
parInc.close_notes = "Test Resolution Notes";
parInc.update();
}
})(current, previous);
------------------------------------------------------------------------
Please let us know if it is helpful or not