I need to add Affected CIs list to the Change Approval notification

Dawid2
Giga Guru

Hello folks,

I'm in a need to add Affected CIs list to the Change Approval notification that is currently running against sysapproval_approver table.

Using available Fields on the notification doesn't seem to fit any of the requirements and I need to include the list of the Affected CI only on the approval notification against sysapproval_approver table.

Can this be achieved in any way? I have no idea how to script it as I don't know Javascript.

Thanks!

1 ACCEPTED SOLUTION

Changed current.sysapproval too ?



gr.addQuery('u_task', current.sysapproval);


View solution in original post

15 REPLIES 15

Hi Thomas,



In the end, I had to use only Impacted Applications, as Affected CIs were not needed.



Here's the email script that worked for me:



var gr = new GlideRecord('u_m2m_tasks_cmdb_ci_appl'); // 'Impacted Bus Applications' related list table


gr.addQuery('u_task', current.sysapproval); // only affected ci's for the task that is being approved. "current" refers to the approval record triggering the notification


gr.query(); //execute the query


while (gr.hasNext()) { //check if the query returned any results


      template.print('<br/><b>Impacted Bus Applications:</b>'); //print to the notification


while (gr.next()) { //loop through each of the returned records


      template.print('<br/>' + gr.u_application.getDisplayValue()); //print the name of the CI


}


}