Multi-line text variable to notification with brakes

T_Anwailer1
Tera Contributor

Hey, I am trying to pull multi-line text variables from request to the notification. It works fine, but the new line breaks from a variable are not included in the notification. Any idea how to solve this?

find_real_file.png
find_real_file.png

My email script:

var id;
if(current.sys_class_name == 'sc_req_item'){
id=current.sys_id;
}else{
id = current.sysapproval.sys_id;
}
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(id);
set.load();
var vs = set.getFlatQuestions();
var table = '<table style="width:75%" border="1">';
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '' ) {
table += '<tr><th>'+vs.get(i).getLabel()+'</th><th>'+vs.get(i).getDisplayValue()+'</th></tr>';
}
}
template.print(table+'</table>');

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you try to print in background script what value it shows?

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

T_Anwailer1
Tera Contributor

when I get this value from background script via glide record on sc_req_item table, it returns WITH new lines break.

find_real_file.png

find_real_file.png

 

Hi,

Can you try to query the ritm table and get the value in the email script?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Spoiler
Spoiler