Email notification with only selected options from select box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 04:48 AM
Hi,
I have a problem with the email that asks for approval.
Item has 3 Select boxes and depending on the first one, the remaining 2 appear.
I would like the notification to show only what the user has selected, not everything.
How can I achieve this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 08:29 AM
User an email notification email script. Below is a code and can be used on multiple notifications depending on the table triggering the notification including approval.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var item_sys_id;
var tableName = current.getTableName();
if(tableName == 'sysapproval_approver'){
item_sys_id = current.sysapproval;
} else if (tableName == 'sc_task'){
item_sys_id = current.request_item.sys_id;
} else if(tableName == 'sc_req_item'){
item_sys_id = current.sys_id;
} else{
item_sys_id ='';
}
//gs.log("SYS ID : "+item_sys_id);
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", item_sys_id);
item.query();
while (item.next()) {
template.print("<div style='font-size:12pt;font-family:Arial, Helvetica, sans-serif;'><span><b>Options</b>:</span><br />");
var keys = [];
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() != '') { //This displays all of the variables (answered/unanswered)
var val = vs.get(i).getDisplayValue();
if (val != '') {
template.space(4);
template.print(vs.get(i).getLabel() + " : " + val + "<br />");
}
}
}
template.print("</div>");
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2024 08:51 AM
some email template is used here:
and when I check what is in the 'requested_items_summary_with_options' place, there is such a script. Should I change anything here?