- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 08:22 AM
When Change request was closed ,automatically associated incidents also closed?
Scenario: We want closed incidents automatically, associated with Change request. When change request closed.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 08:26 AM
HI RAM,
This is a variation on a business rule used for Problem to resolve related incidents, it should do the trick for you; or at least point you in the direction.
if (current.state.changesTo(3)) {
notifyRelatedIncidents(current);
}
//
// Notify any incidents that are related to the current change
//
function notifyRelatedIncidents(me) {
var incident = new GlideRecord("incident");
incident.addQuery("rfc", "=", me.sys_id);
incident.query();
while (incident.next()) {
if (incident.active == true){
var msg = "Associated change request " + me.number + ' closed with the following close notes.\n' + 'Close Notes:\n' + me.close_notes;
if(incident.state != 6,7){
incident.state.setValue(6);
}
incident.work_notes = msg;
incident.update();
}
}
}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 08:24 AM
You can create a Business rule for this. Create a BR in Change Request table with condition state changes to closed. In the script you can get the incident and set state to resolved.
Thank you,
Palani
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 08:25 AM
Hi RAM
Refer below links for approach
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 08:26 AM
HI RAM,
This is a variation on a business rule used for Problem to resolve related incidents, it should do the trick for you; or at least point you in the direction.
if (current.state.changesTo(3)) {
notifyRelatedIncidents(current);
}
//
// Notify any incidents that are related to the current change
//
function notifyRelatedIncidents(me) {
var incident = new GlideRecord("incident");
incident.addQuery("rfc", "=", me.sys_id);
incident.query();
while (incident.next()) {
if (incident.active == true){
var msg = "Associated change request " + me.number + ' closed with the following close notes.\n' + 'Close Notes:\n' + me.close_notes;
if(incident.state != 6,7){
incident.state.setValue(6);
}
incident.work_notes = msg;
incident.update();
}
}
}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2022 11:29 PM
Hi RAM,
Glad to see my answer helped you, Kindly mark the answer as Correct & Helpful both such that others can get help.
Thanks,
Sandeep