- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2015 02:25 AM
Hi All, problem records are usually created from incidents, therefore, we have the incidents related list to track these incident records. Now, we would like to seek your help how can we include these Incidents list with format 'Incident Ticket - Status' in our email notifications. The notifications are sent out when problem record has been updated.
Thank you in advance!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2015 02:55 AM
HI rc393g,
You can create a glide record using mail scripttowards incident and, check against addQuery(problem_id, current.sys); and print if found.
Where problem_id is problem field on incident field which is reference of problem table.
http://wiki.servicenow.com/?title=Scripting_for_Email_Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2015 02:55 AM
HI rc393g,
You can create a glide record using mail scripttowards incident and, check against addQuery(problem_id, current.sys); and print if found.
Where problem_id is problem field on incident field which is reference of problem table.
http://wiki.servicenow.com/?title=Scripting_for_Email_Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 12:50 PM
I have the same issue. Is this correct? thanks in advance. Its showing that i cannot include mail script in email template.
--------------------------------------------------------------------------------------------------
requirement - i need to show related incident in a problem notification.
The following problem record has been opened in ServiceNow and is assigned to your team. The next step is to assign to an individual and proceed with investigation of root cause.
Please contact Problem Management if you believe this problem record was assigned to your team in error.
Problem details :
Number: ${number}
Short description: ${short_description}
Assignment group: ${assignment_group}
Priority: ${priority}
Comments and Work notes: ${comments_and_work_notes}
Related Incidents: ${related_incidents}
<mail_script>
template.print("<p><Related incidents:<br />");
var gr = newGlideRecord("incident");
gr.addQuery("problem_id", current.sys_id);
gr.query();
while(gr.next()) {
template.print(gr.number + ": " + gr.number.getDisplayValue() + ", Stage: " + gr.stage.getDisplayValue() + "<br />");
}
</mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2015 09:20 PM
Saroja D Create mail scripts in System Policy > Email > Notification Email Script starting with the Eureka release. Then add a ${mail_script:script name} embedded script tag to the body of the email notification or template, replacing script name with the name of the script you created. This makes it easy to use the same scripts in multiple email notifications or templates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 07:46 AM
I have done something similar with my two custom tables. How would I fire off email notification only if there is 1 or more problem records? If there is 0 an email/event shouldn't be fired off.