- 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:06 AM
You can get it by notification email scripts
Step 1:
Go to system policy --> Notitfication Emai Script --> New
Name: get_chage_ci_inemail
Script:
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id', current.sysapproval);
gr.query();
if(gr.next()) {
template.print(gr.cmdb_ci.getDisplayValue());
}
Step 2:
Go to System Policy --> Notifications -->Change Approval notification
In the message box paste the line whereever you want ${mail_script:get_chage_ci_inemail}
If you are using email template for this notifcation, open the email template and paste the script ${mail_script:get_chage_ci_inemail} in message sections
Thanks,
Faizeal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:09 AM
Hi Dawid,
You will need to use a notification email script. This should get you started but you'll probably want to tweak it
var gr = new GlideRecord('task_ci'); // 'Affected CIs' 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
if (gr.hasNext()) { //check if the query returned any results
template.print('<br/>Affected CIs:'); //print to the notification
while (gr.next()) { //loop through each of the returned records
template.print('<br/>' + gr.ci_item.getDisplayValue()); //print the name of the CI
}
}
Add it to your approval notification using the following:
${mail_script:getApprovalTaskAffectedCIs}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 02:35 AM
Change
if (gr.hasNext()) {
To
while(gr.hasNext()) {