Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Hi,

can you show alert for this

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

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

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

alert(join);

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

Regards
Ankur

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

'\n' will work properly in alert & in g_form.addInfoMessage() but not in field messges.

Hi,

I would suggest to go with the approach I mentioned about every message on new line

for making it work on portal DOM manipulation etc would be required which is not recommended

Regards
Ankur

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