How to break line in setValue

Abhijit Das7
Tera Expert

Hi Everyone

 

I want to know basic thing. How to break line in setValue .

 

g_form.setValue('comments', exp_id
+',' + model_name
+ ','+ desc );

 

I want break and display like : exp_id

                                                    model_name

                                                    desc 

 
Thanks in advance 
 
1 ACCEPTED SOLUTION

Ahmmed Ali
Mega Sage

Hello,

 

Try below code

g_form.setValue('comments', exp_id + '\n' + model_name + '\n'+ desc );

 

\n will add new line in string.

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

View solution in original post

3 REPLIES 3

Ahmmed Ali
Mega Sage

Hello,

 

Try below code

g_form.setValue('comments', exp_id + '\n' + model_name + '\n'+ desc );

 

\n will add new line in string.

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

Hello Ahmmed,

 

Could you please guide on how to add a newline within a text? Specifically for a field message? Apparently when I am using \n system is still not recognizing the newline within the message.

 

g_form.showFieldMsg('request_type','\\!/ This request only allows you to print.\n\\!/ This will install xx in the phone too','info');
 
This is a script running within an UI policy.

Ankur Bawiskar
Tera Patron
Tera Patron

@Abhijit Das7 

Point mentioned by Ahmmed should work fine.

Please try that and share the updates.

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