Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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
Giga 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
Giga 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

@Abhijit Das7 

Point mentioned by Ahmmed should work fine.

Please try that and share the updates.

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