
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 06:18 AM
Hi,
How can i make a business rule to change incident state of incidents pending change when this change is implemented?
all help is welcomed 🙂
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 06:38 AM
Hi Teresa ,
try this script :
write an after insert / update business rule on incident table
var gr = new GlideRecord('change_request');
gr.addquery('parent',current.sys_id);
gr.addquery('state',7);
gr.query();
if(gr.next())
{
current.setValue('incident_state',6);
current.update();
}
Mark my answer correct and helpful based on impact.
Regards,
Apeksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 06:28 AM
Hi Teresa,
Please refer below link, it may help you.
Kindly mark the answer as Correct and Helpful if this answers your question.
Thank You.
Regards,
Geetanjali Khyale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 06:29 AM
Hey Teresa,
Try in this way:
Business rule name: Resolve incidents from implemented change
Execute after update
Table: change_request
Condition: current.state.changesTo(3) // state 3 is closed complete, by default
Script: Query for all incidents that are pending change related to this change, and resolve them with some default comments
var gr = new GlideRecord("incident");
gr.addQuery("rfc", current.sys_id);
gr.addQuery("state", 4); // incident state 4 is pending change
gr.query();
while (gr.next()) {
// resolve the incident
gr.state = 6; // OOB, resolved is 6
// add some canned comments to the resolved incident
gr.comments = "This incident has been resolved due to the successful implementation of change request " + current.number;
// don't forget to actually update the incident!
gr.update();
}
Hit the Correct and Helpful if works.
Thanks
Namrata.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 03:53 AM
Thanks a lot for your reply!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 06:38 AM
Hi Teresa ,
try this script :
write an after insert / update business rule on incident table
var gr = new GlideRecord('change_request');
gr.addquery('parent',current.sys_id);
gr.addquery('state',7);
gr.query();
if(gr.next())
{
current.setValue('incident_state',6);
current.update();
}
Mark my answer correct and helpful based on impact.
Regards,
Apeksha