- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 07:19 AM - edited 10-26-2022 07:20 AM
Hi All
I have an email script that pulls in the data from a field, and as long as the data is one long string of text the formatting is right.
i have selected Newlines to HTML so every line in the string is a new line.
this does make every line to a new line, but these lines have no formatting and
i would like each new line to be formatted the same, in this case indented with a bullet
this is the base script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
if (current.u_what_is_happening_pt3 != '') {
template.print('<ul><li>' + current.u_what_is_happening_pt3.getDisplayValue() + '</li></ul>');
}
})(current, template, email, email_action, event);
this is the field with text
this is what appears on the email
and this is what i get when previewing, which is better because it looks indented
Any help would be appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 07:34 AM
Hi @DarkWingII,
Try this updated scripts in Email scritps -
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var str = [];
if (current.u_what_is_happening_pt3 != '') {
str = current.u_what_is_happening_pt3.toString().split("\n");
}
for (var i = 0; i < str.length; i++) {
template.print('<ul><li>' + str[i] + '</li></ul>');
}
})(current, template, email, email_action, event);
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2022 07:34 AM
Hi @DarkWingII,
Try this updated scripts in Email scritps -
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var str = [];
if (current.u_what_is_happening_pt3 != '') {
str = current.u_what_is_happening_pt3.toString().split("\n");
}
for (var i = 0; i < str.length; i++) {
template.print('<ul><li>' + str[i] + '</li></ul>');
}
})(current, template, email, email_action, event);
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 09:15 AM - edited 10-28-2022 01:40 AM
Thank you that works a treat!