- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 05:27 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 06:53 AM
I was able to use solution from that link and used text area in HTML
UI Action:
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
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 06:08 AM
UI page will remove line breaks
check this link for workaround, there are 2-3 approaches, I showed 1
Try the easiest approach and see if that works
How can I show line-breaks from string field in UI Page
1) in UI action when you pass replace line breaks with <br> tags
2) in UI page client script add this -> I couldn't find the HTML id for Description, you use your one
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 06:53 AM
I was able to use solution from that link and used text area in HTML
UI Action:
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
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 07:15 AM
@Ankur Bawiskar I have add the HTML content you provided at the top of the existing HTML code and Client script in between of existing client script.
But confused what to be modified at processing script end. and also where are we calling the function we added in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 07:19 AM
check my latest response and enhance your code.
Also in your UI page HTML I couldn't find any html element which is rendering that input box for Description, so curious to know how it's getting rendered
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 07:23 AM
<input type="hidden" aria-hidden="true" name="inc_description" value="$[sysparm_description]" />
this is the line from where we are getting description from sysparm_description and storing it in inc_description and calling that in processing script
var description = typeof inc_description !== "undefined" ? inc_description : "";
And in your latest script, you are not calling the description variable anywhere in the processing script. I tried it and the dialog window is not coming now (kinda not working)