- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 01:52 AM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 03:49 AM
Changed current.sysapproval too ?
gr.addQuery('u_task', current.sysapproval);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:44 AM
Great! And if I wanted to modify it to include Impacted Bus Applications, which part of the script should I correct?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:47 AM
What is the that ? And which table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:49 AM
That would be u_m2m_tasks_cmdb_ci_appl table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:50 AM
Write a similar script and query that table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:55 AM
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.