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 split field message in two lines in client script

Jagen Chinnapul
Tera Contributor

Hi All, 

I need to split the field message into two lines.

 

 textMsg = msg.replace(/\{0\}/g, "Mobile Phone: "+result.mobile_phone1).replace(/\{1\}/g, "Business Phone: "+result.phone);

2 REPLIES 2

BalaG
Kilo Sage

Hi @Jagen Chinnapul   I am assuming you want to textMsg to be split in to two lines, adding "\n" as shown below should do the trick

 textMsg = msg.replace(/\{0\}/g, "Mobile Phone: "+result.mobile_phone1 + "\n").replace(/\{1\}/g, "Business Phone: "+result.phone);

 

hope that helped

--

Bala Guthy

Please mark this as a solution or click helpful as appropriate

Maik Skoddow
Tera Patron
Tera Patron

Hi @Jagen Chinnapul 

it is not clear what your code example should represent.

The only thing I know, is that field messages don't allow HTML, and thus you cannot force a line break within them.

Maik