
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:16 AM
I'm trying to print catalog variables in an email, but the line breaks aren't working and everything prints on one line. Why?
Here's the email template configuration:
And the mail script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var travelFor = '';
if (current.variables.tr_requesting_travel_for == 'tr_myself')
travelFor = current.request.requested_for;
else if (current.variables.tr_requesting_travel_for == 'tr_another_involta_employee')
travelFor = current.variables.tr_employee;
var u = new GlideRecord('sys_user');
u.get(travelFor);
var name = u.name;
var hotel = 'No';
var flight = 'No';
var rentalCar = 'No';
if (current.variables.tr_hotel == 'true')
hotel = 'Yes';
if (current.variables.tr_flight == 'true')
flight = 'Yes';
if (current.variables.tr_rental_car == 'true')
rentalCar = 'Yes';
if (current.variables.tr_trip_type == 'tr_multi_stop')
{
template.print(name);
template.print('\n' + 'Flight: ' + flight + ' Hotel: ' + hotel + ' Rental car: ' + rentalCar);
template.print('\n' + 'Departing on: '+ current.variables.tr_departure_date);
template.print('\n' + 'Traveling to: ' + current.variables.tr_traveling_to);
template.print('\n' + 'and ' + current.variables.tr_is_traveling_to);
template.print('\n' + 'Returning on: ' + current.variables.tr_return_date);
template.print('\n' + 'Reason for travel: ' + current.variables.tr_reason_for_travel);
}
else
template.print(name);
template.print('\n' + 'Flight: ' + flight + ' Hotel: ' + hotel + ' Rental car: ' + rentalCar);
template.print('\n' + 'Departing on: '+ current.variables.tr_departure_date);
template.print('\n' + 'Traveling to: ' + current.variables.tr_traveling_to);
template.print('\n' + 'Returning on: ' + current.variables.tr_return_date);
template.print('\n' + 'Reason for travel: ' + current.variables.tr_reason_for_travel);
})(current, template, email, email_action, event);
I've tried everything short of creating separate mail scripts for each variable but I still see this:
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:18 AM
Since you are sending as HTML, instead of using \n, have you tried using <br> instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:18 AM
Since you are sending as HTML, instead of using \n, have you tried using <br> instead?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:22 AM
Ugh! Why didn't I think of that! 🙂 Thank you so much, I was pulling my hair out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 11:21 AM
Does toggling the Newlines to HTML field in the Notification Email Script have any effect?