hi..i am getting following error when trying to include mail script in body message. Mail Script entered directly into Message HTML will not run. Do you want us to fix your Mail Scripts by moving them to Notification Scripts? does any1 have any idea
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2015 05:12 AM
hi..i am getting following error when trying to include mail script in body message. "Mail Script entered directly into Message HTML will not run. Do you want us to fix your Mail Scripts by moving them to Notification Scripts?". Does any1 have any idea. Following is the code(I clicked yes and tried but the mail script did not run, i also tried to include this code in a template but i am not able to).
Hi ${approver}
A Request has been registered with Ticket No:${sysapproval.number}
and awaiting for your approval.
Requested For: ${sysapproval.requested_for}
Requested By: ${sysapproval.opened_by}
<mail_script>
template.print("Summary of Requested items:\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("request", current.sysapproval);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.cat_item.getDisplayValue() + \n);
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
</mail_script>
<hr/>
${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
Click here to view Approval Request: ${URI}
Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2015 03:56 PM
Hi Shaveta,
It looks like you are running into issues switching between Email Notifications versions 1 and 2. Version 1 used <mail_script></mail_script>, version 2 keeps the script in an email script record and you just include it with it's name like ${summary_of_req_items} and then you put the code in that email script record. When it prompts you with "Do you want us to fix your Mail Scripts by moving them to Notification Scripts?" you will want to say OK. I'm assuming this instance is in Eureka or Fuji. You might want to take a look at these steps: Converting Email Notifications to Rich HTML
Also, here are the "Notifications version 2" attributes that came with Eureka:
Notifications - ServiceNow Wiki
5.2 Eureka
- Properties are available to limit the number and total size of email attachments allowed per email (Eureka Patch 4).
- Email notifications created in Eureka are in a rich HTML format.
- Administrators have the option of converting individual existing email notifications to the rich HTML format.
- Images can be inserted into email notifications with an image picker in the WYSIWYG editor.
- Images linked with URLs relative to a particular instance are converted to absolute URLs, preventing broken links.
- Mail scripts are condensed into a single, easy-to-read line that can be reused in multiple email notifications.
- A Newlines to HTML check box has been added to the Email Script form to help ensure backward compatibility with older scripts.
- Properties are available for controlling the conditions by which recipient notifications are logged.
- Administrators can filter device notifications using a schedule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2015 01:09 AM
Hi Ben..yes the instance is Eureka. When it prompts me with "Do you want us to fix your Mail Scripts by moving them to Notification Scripts?" I click "yes" but the mail script does not run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2015 05:07 PM
When you click that you will want to check that it removed anything inside <mailscript> tags and created a record for it in "notification email scripts" and then replaced it in the notification like this: ${your_script}
if you have a ${your_script} in your notification, the notification is set to "html" or "html and plaintext", and if there actually is a notification email script named "your_script", then it should run. If not, right click your notification's header banner and select 'show XML' and let me know the value of "sys_version".
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2015 05:18 AM
Hi Ben,
I am also ran into issues with "notification email scripts" .
I want to add article content reviewer's email(which is dynamic base one each article) in CC when I send notifications to others. But looks like I am unable to pass reviewer's email to the email scripts. Do we need to pass any parameter to the script? Could you pls guide how to build the email scripts?
I call the script in notification message HTML by using ${mail_script:kb_knowledge_script_1}
The script can work when I specified the user in the script. But I have no idea how to get the reviewer's email.
You can refer to below link for my original questions. Really appreciate your insights!
How to add group email address and content viewer in CC notification