Sample of using script include in email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 12:30 PM
Hi everyone,
I need help with calling a script include into an email notification. I am looping over the email body and if there are mandatory variables missing in the email then a notification gets sent to the user. I am able to get the missing/mandatory variables but can not format the question neatly in the email notification. Any help would be greatly appreciated.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 12:52 PM
You can call a script include in a mail script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 01:01 PM
Abhinay,
Am I calling it right?
Script Include:
var VariableScript = Class.create();
VariableScript.prototype = {
initialize: function(list) {
this.list = list;
},
createTable: function() {
var a = JSON.parse(event.parm2);
var allMandatory = a.allMandatory;
var missingMandatory = a.missingMandatory;
for (var i = 0; i < allMandatory.length; i++) {
template.print(allMandatory [i] );
}
},
list: [],
type: 'VariableScript'
};
Email Notification:
<mail_script>
var a = JSON.parse(event.parm2);
var allMandatory = a.allMandatory;
var missingMandatory = a.missingMandatory;
var b = new VariableScript();
b.createTable();
for (var i = 0; i < allMandatory.length; i++) {
template.print(allMandatory [i] );
};
for (var i = 0; i < missingMandatory.length; i++) {
template.print(missingMandatory [i] );
};
</mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 01:13 PM
Yes that is correct. Which release are you on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 01:19 PM
Geneva. Do you know a way to include the Message text and header and footer in the notification? When I change the Content Type to HTML and Plain Text it combines all the text and makes it look squished.