- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 10:09 AM
Hello,
I need to insert close notes (present in the task table) in the notification which was built on requested item table.
Can you let me know how to achieve this?
Best,
Akshitha
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 03:30 PM
Thanks for the clarification. In your message HTML include this:
Close notes: ${mail_script:task_close_notes}
Navigate to System Notification> Email> Notification Email Scripts and create a new record with the name: task_close_notes.
For the script: use this
var scTask = new GlideRecord('sc_task');
scTask.addQuery('request_item',current.getValue('sys_id'));
scTask.query();
if (scTask.next()) {
if (scTask.closed_notes != "") {
template.print(scTask.getValue('closed_notes');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 05:13 PM
Are you sure there is a valid value in the field? If so, how?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2016 12:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 10:29 AM
You need to write a mail script which queries the task table and gets notes and call that mail script from your notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 10:37 AM
Hello,
Can you guide me in building the mail script?
Best,
Akshitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2016 10:46 AM
under System Notification --> Notification Email Scripts -> New
Name:YourScriptName
coy below code and make neccessary changes based on your requirement.
var gr = new GlideRecord('Your_Task_Table');
gr.addQuery('your_parent_field_name',current.sys_id);
gr.query();
while(gr.next()) {
if(gr.closed_notes != "")
{
template.print('<li>Closed Notes: ' +gr.closed_notes+ '</li>');
}
}
and in the notification call the mail script like below
<p>${mail_script:YourScriptName}</p>