CI Affected Notification for Change Requests

nysbto
Kilo Explorer

Has anyone had any success setting up Affected CI Notifications from a change Request? We are looking to spawn an email to the customers of CIs that are affected by a Change Request after the change has been approved. I have copied the script from the CI Affected Notifications business rule that fires the event for incidents into a new Script Action so that I could fire it from the workflow, but when users try to subscribe to the email the Configuration Item field does not pop for the user to subscribe to a CI. Is there a way to make this work or better yet have it simply send an email to all users in a group field listed on the CI automatically without having the have the users subscribe to each CI individually?

2 REPLIES 2

alhicks
Tera Guru

I was given this code from Brad (Navigus). I've posted another comment trying to see if there's a way to fire this event and look at the relationship of the ci instead of just the owned by of the ci.

Need help with Run Script to fire event notification from Workflow

var ct = new GlideRecord('change_task');
ct.addQuery('change_request', current.sys_id);
ct.query();
gs.log("Number of tasks: " + ct.getRowCount());
while (ct.next()) {
gs.eventQueue('server_downtime_notification', ct, ct.cmdb_ci.owned_by, ct.sys_id);
}



daya
Kilo Explorer

I put this set of code on change_request table. In mail_script.

The following CI's will affected by this change:


var gr = new GlideRecord("task_ci");
gr.addQuery("task",current.sys_id);
gr.query();
while(gr.next())
{
template.print(' ' + gr.ci_item);// This give the sys_id of affected CI
var nameCI = new GlideRecord("cmdb_ci");
nameCI.addQuery("task_ci",gr.ci_item);
nameCI.query();
while(nameCI.next())
{
if(nameCI.sys_id == gr.ci_item){
template.print(' ' + nameCI.name); // This gives the name of sys_id of CI

}
}