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

Great! And if I wanted to modify it to include Impacted Bus Applications, which part of the script should I correct?


What is the that ? And which table?


That would be u_m2m_tasks_cmdb_ci_appl table.


Write a similar script and query that table.


I built following script:



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


gr.addQuery('task', current.sys_approval); // 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/>Impacted Bus Applications:'); //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


        }


}



And now notification shows every application we have in the sytem and not only this affected by change.