How to add 'Impacted Services/CIs' to an email notification

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 05:43 AM
Hi Everyone,
I'm in a change record, using a quick message email template which has multiple variables defined within the body of the message in order to draw data straight out of the populated change record (ie: ${short_description}, ${start_date}, ${end_date}, etc etc). These are all variables straight from the change_request table.
I need to add items listed under the related list 'Impacted Services/CI's'. How can I do this? I think I need to do a mail script but I have no idea how.
Any help with that would be greatly appreciated.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2018 08:12 AM
This thread may help you ( this one is for [problem])
https://community.servicenow.com/community?id=community_question&sys_id=e1be8761dbdcdbc01dcaf3231f96191d&view_source=searchResult
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2018 12:43 PM
Please enter below lines based on your requirement in your notification:
Affected CIs: <mail_script>
var gr = new GlideRecord('task_ci');
gr.addQuery('task',current.sys_id);
gr.query();
while(gr.next()){
template.print(gr.ci_item.name+'< >');
}
</mail_script>
Impacted CIs: <mail_script>
var gr = new GlideRecord('task_cmdb_ci_service');
gr.addQuery('task',current.sys_id);
gr.query();
while(gr.next()){
template.print(gr.cmdb_ci_service.name+'< >');
}
</mail_script>
While saving you will be see an alert as below, please click on Yes then the system will make the scripts we have entered above as Notification Scripts so as to make use of them in different notifications.
This will definitely work