
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 03:20 PM
I'm using the mail script below to pull variables from a requested item into a notification, but I'd like to insert a line break between each variable. How would I accomplish this? I assume it is in the line that is red below because it is inserting :: between each variable instead of a line, but I'm not sure how to tell it to insert a line break instead.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 03:48 PM
@sarahjantz : I modified your code; please try it below. Please make sure that the "Newlines to HTML" checkbox is checked on the email script.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.request_item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getDisplayValue() != '' && +vs.get(i).getLabel() != '') {
template.print(vs.get(i).getLabel() + "::" + vs.get(i).getDisplayValue());
template.print("\n");
}
}
})(current, template, email, email_action, event);
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 03:48 PM
@sarahjantz : I modified your code; please try it below. Please make sure that the "Newlines to HTML" checkbox is checked on the email script.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.request_item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getDisplayValue() != '' && +vs.get(i).getLabel() != '') {
template.print(vs.get(i).getLabel() + "::" + vs.get(i).getDisplayValue());
template.print("\n");
}
}
})(current, template, email, email_action, event);
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2023 03:54 PM
Thank you!!