Run Mail Script in Email Template?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 08:45 AM
I have to be doing something wrong that someone will see here.
Here is my scenario: A user receives a notification from ServiceNow and has the option to click on a mailto link to send back and kick off an inbound action, similar to the approval emails. I want a the new email to popup with prefilled Subject/Body but I also need to include an email in the CC. I wrote a mail script to add the CC email address. I am calling it in the email template but it just prints the variable and doesn't run. I put in another variable and it seems to work fine. I checked the source code and there isn't any funky HTML happening around it. Can we not call mail scripts in the email templates? If not, what are my options? Much appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 09:06 AM
Hi Cheri,
Per some information I got earlier this week, yes - mail scripts should run from within email templates.
What version of ServiceNow are you running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 09:10 AM
We just went to Geneva Patch 7 this week. geneva-08-25-2015__patch7-05-04-2016.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 09:14 AM
Confirming what Chuck said-- 2 email template examples in baseline code that run mail scripts: hr_case.resumed and hr_task.closed
Make sure you're using the correct parameters. From the wiki example:
email.addAddress("cc", "john.copy@example.com","John Roberts");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2016 09:22 AM
1. you will put a mailto mail script in your email notification;
ex. ${mailto:mailto.incident.resolve}
that in turn will pull the template as seen below.
in your email template you actually need to not put the script, but put field values like so
Then when you link is clicked in the email, it prepopulates the text in the "message" above in the body of the email.
I'm not sure if you can put a mail script within the message text to populate a cc address.
I can CONFIRM that mail scripts do run from within a template, but i'm not sure they run within outlook to populate the cc. I know the mail scripts run from template, because we use many mail scripts from within templates.
However, when i click the Resolve Incident, no scripts run from there in Outlook, as these are ServiceNow Scripts, not Outlook scripts.