The CreatorCon Call for Content is officially open! Get started here.

After form submitting single line value displayed instead of multiple lines text

JVINAY
Tera Contributor

Hi Team,

My Requirement is:

I have added 4 lines point-wise in acceptance Criteria like below.

JVINAY_0-1743146234378.png

But after submission , it's displaying as single line , Like below

 

JVINAY_2-1743146392227.png

Acceptance Criteria Variable type : Multi line Text

What could be the Issue , Please help me.

Thank you.

 

 

1 ACCEPTED SOLUTION

Robert H
Mega Sage

Hello @JVINAY ,

If possible, just change the type of the "Acceptance Criteria" variable from Multi Line Text to HTML.

Else you would have to add a script like this to the Record Producer:

current.acceptance_criteria = producer.getValue('acceptance_criteria').replace(/\n/g, '<br>');

 Note: not sure if the "accepance_criteria" in your post is just a typo. In my example I have spelled it as "acceptance_criteria".

Regards,

Robert

View solution in original post

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @JVINAY 

Is the first screenshot from a Catalog item? If yes, then I think it is some expected behaviour of the HMTL field, and it shows in one line.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG ,

Yes This is Record Producer, 

How can I  resolve this ?

Can I write Following script in , Record Producer Script section

current.accepance_criteria= producer.type_of_request + "\n\n" + producer.accepance_criteria
Its works or any other solution Please let me know.
Thank you for your responce.

Ankur Bawiskar
Tera Patron
Tera Patron

@JVINAY 

try this if you want each new line to be a separate line in target HTML field

current.accepance_criteria= producer.type_of_request.replace(/(?:\r\n|\r|\n)/g, '<br/>');

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar ,

After Adding this line.

Acceptance criteria is Empty. adding text is missing.

 

JVINAY_0-1743147756621.png

 

Script section Screenshot:

JVINAY_1-1743147876499.png

Line no2 script for Description( Multiline Text)  filed , its working as Expected , But Acceptance criteria is not working .

Please guide me what changes are to be made to resolve this.