- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2019 03:04 AM
HI All,
I have a requirement,
I have already closed a few parent incidents, but I want child incidents to be closed automatically by using background scripts.
Any suggestions?
Thanks,
JMR
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2019 03:20 AM
Hello JMR,
Check out following script:
var gr= new GlideRecord("incident");
gr.addQuery('parent',"sysID of Incident");
gr.query();
while(gr.next()){
// here you can set values that you want to set before closing incidents
gr.setValue('state', '6'); // value for closed or resolved
gr.setWorkflow(false);
gr.autoSysFields(false)
gr.update();
}
NOTE:
1.‘setWorkflow’ is used to enable/disable the running of any business rules that may be triggered by a particular update.
2. ‘autoSysFields’ is used to disable the update of ‘sys’ fields (Updated, Created, etc.) for a particular update. This really is only used in special situations. The primary example is when you need to perform a mass update of records to true up some of the data but want to retain the original update timestamps, etc.
Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2019 03:11 AM
HI ,
please refer this link:
it might help you .
If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons!
Regards,
Apeksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2019 03:20 AM
Hello JMR,
Check out following script:
var gr= new GlideRecord("incident");
gr.addQuery('parent',"sysID of Incident");
gr.query();
while(gr.next()){
// here you can set values that you want to set before closing incidents
gr.setValue('state', '6'); // value for closed or resolved
gr.setWorkflow(false);
gr.autoSysFields(false)
gr.update();
}
NOTE:
1.‘setWorkflow’ is used to enable/disable the running of any business rules that may be triggered by a particular update.
2. ‘autoSysFields’ is used to disable the update of ‘sys’ fields (Updated, Created, etc.) for a particular update. This really is only used in special situations. The primary example is when you need to perform a mass update of records to true up some of the data but want to retain the original update timestamps, etc.
Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2019 11:24 PM
Any updates on this?
Can you 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.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2019 11:52 PM
Hi abhishek,
Thanks for your reply