UI Action to push UI Page Display HTML field

alexcharleswort
Tera Expert

Hey All,

I seem to have a need where I need to make a UI Page that will display when I click a UI Action on a record. On this UI Page I need to grab the contents of an HTML field on that same record. The issue that I am having is that when the ui page display, the HTML field contents are displayed with all their tags. I tried adding <g2:no_escape> to the UI Page script and that doen't seem to work. 

Here is my code on the ui page:

<?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:evaluate>
var pa = new GlideRecord('u_hr_forms'); 
pa.get('b76a050f4f5423007dc7ea7d0210c720');
</g:evaluate>

<g2:no_escape>${HTML:pa.u_verbiage.getDisplayValue()}</g2:no_escape>

</j:jelly>

 

When I click 'Try it' from there it shows me:

find_real_file.png

 

HOWEVER! When i go into that record and click the ui action it shows me: 

find_real_file.png

 Here is my code for my UI Action

function signForm(){ 

//Initialize and open the dialog  
var dialog = new GlideDialogWindow("hr_form"); //Instantiate the dialog containing the UI Page 'add_comments_dialog'  
dialog.setTitle("Sign the Request"); //Set the dialog title  
dialog.setWidth(1000);
dialog.setPreference('sysparm_draw_only', 'true');  

dialog.render(); //Open the dialog   
} 

How do i get the dialog box from the ui action to look like the try it button on the ui page record?

 

Thanks in advance for any help!

Alex

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Alex,

 

Replace <g2:no_escape>${HTML:pa.html.getDisplayValue()}</g2:no_escape> with <g:no_escape>${HTML:pa.html.getDisplayValue()}</g:no_escape>

 

Updated code below.

<?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:evaluate>
var pa = new GlideRecord('hr_form');
pa.get('b76a050f4f5423007dc7ea7d0210c720');
</g:evaluate>

<g:no_escape>${HTML:pa.u_verbiage.getDisplayValue()}</g:no_escape>


</j:jelly>

 

-Pradeep Sharma

View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Alex,

 

Replace <g2:no_escape>${HTML:pa.html.getDisplayValue()}</g2:no_escape> with <g:no_escape>${HTML:pa.html.getDisplayValue()}</g:no_escape>

 

Updated code below.

<?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:evaluate>
var pa = new GlideRecord('hr_form');
pa.get('b76a050f4f5423007dc7ea7d0210c720');
</g:evaluate>

<g:no_escape>${HTML:pa.u_verbiage.getDisplayValue()}</g:no_escape>


</j:jelly>

 

-Pradeep Sharma

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Alex,

 

Is the issue resolved now? If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thanks,

Pradeep Sharma

alexcharleswort
Tera Expert

Sorry, Pradeep. For some reason my notification preferences on this thing are completely messed up so I didn't know you responded. I kept getting notifications on posts that had answers marked correct that I had never even seen before so in my attempt to shut them off I managed to shut 80% of them off as well as the notifications for my actual posts. 😕

 

thanks for your help!!!