- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 08:56 AM
I have a catalog item that as a workflow associated with it. Once the request is approved by the approvers, an email notification needs to be sent out to a group of users.
This email should contain the request details as it is being sent to users who are external to the organization. So i cannot send them a link to the catalog item record .
So i want to populate the email body with the variables from the request.
So i have created a Email Template, Notification and an event which is fired after the request is approved.
I want to a mail script that will let me include the variables to the body of the email that will be sent out.
I tried to add a mail script but i wasn't able to link it to the Template or call it anywhere in the notification or template.
Any suggestions?
Thanks..
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:03 AM
All the mailscripts are stored in notification email script module. You can print the variables in format current.variables.variable_name as shown below
Then you can call email script from notification using below format
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:02 AM
Hi Amol,
I doubt if you can add a mail script in an email template. You will have to add the mail script directly on the notification message HTML field as
${mail_script:script name}
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:03 AM
All the mailscripts are stored in notification email script module. You can print the variables in format current.variables.variable_name as shown below
Then you can call email script from notification using below format
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 10:22 AM
Sanjiv,
Thanks for your input. The script below seems to be working but prints everything in a single paragraph.
template.print("<p></p>Requested items:\n");
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
//while(gr.next()) {
//template.print(gr.number + ": " + gr.cat_item.getDisplayValue() + ", Stage: " + gr.stage.getDisplayValue() + "\n");
// template.print("Request number: " + gr.request.number + "\n");
if (current.cat_item.name.indexOf('Corporate Real Estate V2') > -1)
{
template.print('\n'+"Indicate Group: "+ current.variables.Indicate_Group + "\n");
if (current.variables.CRE_BC_BP != false)
{
template.print('\n'+"Project Driver: " + "Business Process" + "\n");
}
if (current.variables.CRE_BC_NewContract != false)
{
template.print('\n'+"Project Driver: " + current.variables.CRE_BC_NewContract + "\n");
}
if (current.variables.CRE_BC_ChginContract != false)
{
template.print('\n'+"Project Driver: " + current.variables.CRE_BC_ChginContract + "\n");
}
if (current.variables.CRE_BC_Reorg != false)
{
template.print('\n'+"Project Driver: " + current.variables.CRE_BC_Reorg + "\n");
}
if (current.variables.CRE_BC_Other != false)
{
template.print('\n'+"Project Driver: " + current.variables.CRE_BC_Other + "\n");
}
}