- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 09:45 PM
Hi Team,
Have written Notification which is triggering on approval table based on the approval triggered in the catalog task, I am not able get the catalog variables in the notification. For Example Deferal: ${sysapproval.u_servers_for_deferral} u_servers_for_deferral field is catalog task.
Can anyone help me on how get the catalog task variables printed in Notification
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 09:56 PM
@Sowmya You can have a notification email script created as below and add it to your notification with mailscript syntax,
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var gr = new GlideRecord('sc_req_item');
gr.get(current.document_id);
//If required for specific catalog item, mention the sys id in the "If" statement
//if ((gr.cat_item == "")
template.print("<b>"+"Request Details:"+"</b>"+"<br/>"+"<br/>");
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
template.space(1);
template.print("<b>" + vs.get(i).getLabel() + "</b>" + " : " + vs.get(i).getDisplayValue() + "<br/>");
}
}
})(current, template, email, email_action, event);
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 09:56 PM
@Sowmya You can have a notification email script created as below and add it to your notification with mailscript syntax,
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var gr = new GlideRecord('sc_req_item');
gr.get(current.document_id);
//If required for specific catalog item, mention the sys id in the "If" statement
//if ((gr.cat_item == "")
template.print("<b>"+"Request Details:"+"</b>"+"<br/>"+"<br/>");
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.getValue('sysapproval'));
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' && vs.get(i).getDisplayValue() != 'false') {
template.space(1);
template.print("<b>" + vs.get(i).getLabel() + "</b>" + " : " + vs.get(i).getDisplayValue() + "<br/>");
}
}
})(current, template, email, email_action, event);
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.