- 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 11:38 PM
Can you paste the screenshot of the condition nd code over here, also i think as per OOB the child gets resolved when parent changes to resolved and the resolved state value is 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 12:03 AM
HI,
Please find the condition below:
current.isValidRecord() && (current.state.changesTo(IncidentState.RESOLVED) || current.comments.changes() || current.work_notes.changes()) && (current.child_incidents > 0)
we're trying to attach the scripts screenshots but it's taking more time to upload it,
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 12:20 AM
Hello
Can you try to change the incident state to resolved and see if the child Incident is getting resolved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 12:56 AM
Hi,
yes, it’s working fine if we change the incident state to resolved then child incident state also changing to resolved. But if we change to closed then child incident state is not changing to closed!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 01:12 AM
Yeah right that is because the OOB design is that a user will resolve the Incident and then after certain days it will autoclose. There is a business rule which controls after how many days it will get closed. This is because a normal itil user will not be able to see the closed state in OOB design
Business rule:- Incident autoclose
You can also define after how many days you want the Incident to autoclose using the below property
glide.ui.autoclose.time
Please mark answer correct/helpful based on Impact.