Not able to copy description with line Breaks from UI Action to UI Page

Deepika18
Tera Guru

Hi All,

 

I have created an UI Action on Case form to create a Incident with all the information available on Case.

 

As "Service Offering" is not available on Case I have created a dialog box using UI Page and GlideModal asking for service offering.

 

But now everything is fine except the description is not getting copied with Line breaks. The Line breaks are getting disappeared in HTML in UI Page. 

Requesting you to help me with this issue.
@Ankur Bawiskar 

1 ACCEPTED SOLUTION

@Deepika18 

I was able to use solution from that link and used text area in HTML

UI Action:

AnkurBawiskar_0-1750859534856.png

 

UI Page:

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:ui_form>
		<g:evaluate var="jvar_sysid"
					expression="RP.getWindowProperties().get('sysid')"/> 

					
Description: <textarea id="description" rows="10" cols="30" name="description" value=""/>
			</g:ui_form>
</j:jelly>

Client Script:

addLoadEvent(function(){
	var m = GlideModal.prototype.get("showHTMLLineBreaks");
	var p = m.getPreference("description");
	document.getElementById("description").innerHTML = p; //create div with same id in HTML and set the innerHTML to the preference we grabbed from the Client Script
});

Output

AnkurBawiskar_1-1750859587296.png

 

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

View solution in original post

11 REPLIES 11

@Ankur Bawiskar 

I have modified as per your suggestions and it is working fine now.

Thank you so much for the quick help 🙂

@Deepika18 

Glad to help.

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