
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 03:05 PM - edited 06-18-2024 03:06 PM
I have a script includes that works correctly when calling via a catalog item, however, I'm trying to call the same script include via notification script and it does not appear to be passing the parameter, what am I doing wrong.
Script Includes:
var NotaryInstructions = Class.create();
NotaryInstructions.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNotification: function() {
var sysIDType = this.getParameter('sysparm_query_sysIDType');
var parameters = sysIDType.split(',');
var sysID = parameters[0]; //used to look up records, excluded from this script for brevity
var n_type = parameters[1]; //used to set content
var html = '';
if(n_type == 'instructions'){
html = '<p>This is the instructions</p>';
} else {
html = '<p>This is the other return value</p>';
}
return html;
},
type: 'NotaryInstructions'
});
Notification Script:
NOTE: I also tried using GlideAjax but the log showed that GlideAjax was not recognized as a function from the Notification Script.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var state = current.u_state;
var parameters = current.sys_id + ',instructions';
var helper = new NotaryInstructions();
var instructions = helper.getInstructions(parameters);
email.setSubject("Notary Commission Instructions for the state of " + state.toUpperCase());
//email.setBody(instructions);
template.print(instructions);
})(current, template, email, email_action, event);
Notification Outputs
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 02:04 PM - edited 06-24-2024 02:08 PM
We were able to get Developer Support from SNOW and it was the Script includes that needed modified to add an if statement if undefined:
var NotaryInstructions = Class.create();
NotaryInstructions.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNotification: function(sysIDType) {
if (typeof sysIDType === 'undefined') {
sysIDType = this.getParameter('sysparm_query_sysIDType');
}
var sysID = parameters[0]; //used to look up records, excluded from this script for brevity
var n_type = parameters[1]; //used to set content
var html = '';
if(n_type == 'instructions'){
html = '<p>This is the instructions</p>';
} else {
html = '<p>This is the other return value</p>';
}
return html;
},
type: 'NotaryInstructions'
});
Also a couple of minor edits on the notification script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
//Get state
var state = current.u_state;
var sysIDType = current.sys_id + ',instructions';
var helper = new NotaryInstructions();
var instructions = helper.getNotification(sysIDType);
email.setSubject("Notary Commission Instructions for the state of " + state.toUpperCase());
email.setBody(instructions);
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 07:56 PM
Please refer the Script Include and the Email Script I have provided and compare it with your implementation. As already highlighted by @Kris Moncada , I could also see many things missing.
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 02:04 PM - edited 06-24-2024 02:08 PM
We were able to get Developer Support from SNOW and it was the Script includes that needed modified to add an if statement if undefined:
var NotaryInstructions = Class.create();
NotaryInstructions.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNotification: function(sysIDType) {
if (typeof sysIDType === 'undefined') {
sysIDType = this.getParameter('sysparm_query_sysIDType');
}
var sysID = parameters[0]; //used to look up records, excluded from this script for brevity
var n_type = parameters[1]; //used to set content
var html = '';
if(n_type == 'instructions'){
html = '<p>This is the instructions</p>';
} else {
html = '<p>This is the other return value</p>';
}
return html;
},
type: 'NotaryInstructions'
});
Also a couple of minor edits on the notification script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
//Get state
var state = current.u_state;
var sysIDType = current.sys_id + ',instructions';
var helper = new NotaryInstructions();
var instructions = helper.getNotification(sysIDType);
email.setSubject("Notary Commission Instructions for the state of " + state.toUpperCase());
email.setBody(instructions);
})(current, template, email, email_action, event);