how to write field message in new line?

ribka_sarimalla
Kilo Contributor

I want field message to appear like below in a single field message not like double messages.

find_real_file.png

I have tried \n, <br>,<BR> but no use. Please suggest.

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@ribka.sarimalla@gmail 

Another way which would work in both native and portal

var message_text = 'line1' + '*' + 'line2' + '*' + 'examples :' + '*' + 'line3' + '*' + 'line4';

var arr = message_text.split('*');

for(var i=0; i<arr.length ; i++)
{
g_form.showFieldMsg('variable', arr[i], 'info');
}

Regards
Ankur

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

@ribka.sarimalla@gmail 

Another way which would work in both native and portal

OR try this

var message_text = 'line1' + '*' + 'line2' + '*' + 'examples :' + '*' + 'line3' + '*' + 'line4';

var arr = message_text.split('*');

var join = arr.join('\n');

g_form.showFieldMsg('variable', join, 'info');


Regards
Ankur

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

Hi Ankur, 

It is displaying message in separate lines, I want it in single message like above screenshot. 

Hi,

try this and share the screenshot

var message_text = 'line1' + '*' + 'line2' + '*' + 'examples :' + '*' + 'line3' + '*' + 'line4';

var arr = message_text.split('*');

var join = arr.join('\n');

g_form.showFieldMsg('variable', join, 'info');


Regards
Ankur

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

Still showing in single line, PFB screenshot.

find_real_file.png