UI Page script to show element display value

tsutherland
Kilo Sage

I am editing the OOB Project Summary dashboards and created a UI Page to show information about the project's status report.

find_real_file.png

However I can't seem to get rid of the HTML codes on the widget. The original field on the form is HTML. Here is my script:

<?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 jelly="true" object="true">
		var projectId = gs.getUser().getPreference('com.snc.project_management.home_page.project');
		var gr = new GlideRecord('pm_project');
		gr.get('sys_id', projectId);
		var summary = gr.getElement('u_project_status.executive_summary').getDisplayValue();
	</g:evaluate>
		<table class="wide">
		<tr>
			<td align="left">
				<body>${summary}</body>
			</td>
		</tr>
	</table>
</j:jelly>

The field "u_project_status" is a custom reference field on the project table which is populated with the latest status report. I did that so I could dot-walk to the information I needed. I get the data, but not without those HTML tags. Is there a better way to do this? Anyone know the syntax I could use to achieve this?

1 ACCEPTED SOLUTION

tsutherland
Kilo Sage

I found this community article answered by @Manish Vinayak  and using the no_escape tag worked perfectly!

<?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 jelly="true" object="true">
		var projectId = gs.getUser().getPreference('com.snc.project_management.home_page.project');
		var gr = new GlideRecord('pm_project');
		gr.get('sys_id', projectId);
		var summary = gr.getElement('u_project_status.executive_summary').getDisplayValue();
	</g:evaluate>
			<td align="left">
				<g:no_escape>
					<p> ${summary} </p>
				</g:no_escape>
			</td>
</j:jelly>

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi,

Can you embed your image (so save it on your side then embed (not attach)) so that we can see it easily?

Right now, the image is broken if you've just tried to paste it (the forums are acting wonky for the past few months regarding this).

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you! I've edited the post and embedded the image 🙂

tsutherland
Kilo Sage

I found this community article answered by @Manish Vinayak  and using the no_escape tag worked perfectly!

<?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 jelly="true" object="true">
		var projectId = gs.getUser().getPreference('com.snc.project_management.home_page.project');
		var gr = new GlideRecord('pm_project');
		gr.get('sys_id', projectId);
		var summary = gr.getElement('u_project_status.executive_summary').getDisplayValue();
	</g:evaluate>
			<td align="left">
				<g:no_escape>
					<p> ${summary} </p>
				</g:no_escape>
			</td>
</j:jelly>

Malathi Vinoth
Tera Contributor

Hi tsutherland,

I was going through your community post for stored procedure

Using JDBC Custom Activity for MSSQL Stored Procedure - Now Platform - Question - ServiceNow Communi...

I am in need of this activity I am unable to do connection and not sure how to call the stored procedure

Any inputs from you will be helpful. If possible can you provide your EMail address to have my question brief