Can I properly show a value from an HTML field in a UI Page?

Shane J
Tera Guru

Is there any way to show the value of an HTML field properly when it's delivered in a pop-up that shows a UI page?

Right now any HTML comes across as regular text and isn't translated in the XML of the UI Page.

See here for reference: https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/client_scripts/reference/r...

 

1 ACCEPTED SOLUTION

Hi Shane,

 

Here's an example of how you can get the values using client script in a UI Page Preview and set the values in the page content.

find_real_file.png

In the above script, in the Client script section, you'll see that GlideForm,i.e., g_form methods are used to access the value of "short_description". I have included comments to give you an idea of the purpose of those statements.

The values accessed using g_form methods are then set in the UI Page content using DOM Methods (it is not going to get impacted by any upgrade as it is your own HTML code, which is not going to change its document structure). 

So, here is the incident form where I tried previewing the UI Page:

find_real_file.png

 

And here is the preview result using the UI Page:

find_real_file.png

 

This implementation got the results from the client side of the form, not the server side. So you'll get the current values even if they're not yet saved.

 

Hope this helps!

Cheers,

Manish

View solution in original post

12 REPLIES 12

This is working, thank you!

No worries. Glad that it worked 🙂

Cheers,

Manish

@Manish Vinayak1

 

I am having same issue with a ui page. I have that annoying <p> showing up with my text, how do I remove/hide the <p>. Any pointers please, I appreciate it 

JuneAnderson_0-1713386643945.png

 

JuneAnderson_0-1713390221294.png