- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 10:32 PM - edited 10-04-2022 10:37 PM
Hi,
Can anyone please help us on the below requirement.
We want to close all the child INC tickets when the Parent INC ticket state changes to closed.
We wrote one After / update --> Business rule but some reasons the child ticket state not changing to closed.
and also we want to copy the work notes and parent inc number from parent to child ticket work notes.
Script:
(function executeRule(current, previous /*null when async*/) {
var num = current.number;
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.addQuery('parent',current.sys_id);
//inc.orderByDesc('sys_created_on');
inc.query();
while(inc.next())
{
if(inc.incident_state != 7)
{
inc.incident_state = 7;
if(JSUtil.notNill(current.comments.getJournalEntry(1)))
{
inc.comments = num + " : " + current.comments.getJournalEntry(1);
}
inc.update();
}
}
Advance Thanks.
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 03:00 AM - edited 10-05-2022 03:01 AM
Hello,
The attached notepad contains the filter condition and the complete script just copy paste it:-
Please mark my answer as correct.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 10:45 PM - edited 10-04-2022 10:54 PM
Hello,
I see you have updated your requirement
There should be an OOB business rule written on incident table "Update Child Incidents" which close the all child incident once parent closes. Is it not active in your instance?
Please mark answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 10:59 PM
Hi Saurav,
Many thanks for the response.
Yes, you're right we saw the "Update Child incidents " Business rule but it's not changing the child incident ticket state to closed when we changes the parent inc ticket state to closed.
And while closing the parent INC ticket, we entered some text in worknotes that is also not coping to child tickets.
ANy idea, how to achieve this ??
Advance thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 11:15 PM
Hello,
Was the BR ever changed by anyone of you? Also have you customized your Incident form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2022 11:28 PM
Hi Saurav,
As per the existing BR, child inc state values are changing when ever we change the parent inc state value changes except the closed time.
And we are not changed the script recently.
Thanks.