error on UI Page: 'The entity "nbsp" was referenced, but not declared '

david_myers
Tera Contributor

I have an HTML field (u_related_information) on a custom table and I want to display it's contents on a UI Page.   I can get it to correct render the contents in some instances, however If the field contains   I get an error when rendering the Page. 'The entity "nbsp" was referenced, but not declared.'

Any ideas how I can correct this?

Below is my code

<g:evaluate var="sysparm_detail_sysid">

var sysparm_detail_sysid = RP.getParameterValue("sysparm_detail_id");

sysparm_detail_sysid;

</g:evaluate>

<g:evaluate var="jvar_system_status" jelly="true">

var sysStatus = new GlideRecord('u_it_daily_system_status');

sysStatus.addQuery('sys_id', jelly.sysparm_detail_sysid);

sysStatus.query();

</g:evaluate>

<j:while test="${sysStatus.next()}">

<div class="detail">

<div><span class="${sysStatus.getValue('u_icon').toLowerCase()}">System:</span>${sysStatus.getDisplayValue('u_system')}

</div>

<div><span class="detaillabel">Related Information:</span><g:no_escape>${sysStatus.u_related_information.getHTMLValue()}</g:no_escape>

</div>

</div>

</j:while>

3 REPLIES 3

Artemis15
Kilo Guru

Hi David,



you see variable "sysStatus" has been covered up by "jvar_system_status" in following code:



<g:evaluate var="jvar_system_status" jelly="true">


var sysStatus = new GlideRecord('u_it_daily_system_status');


sysStatus.addQuery('sys_id', jelly.sysparm_detail_sysid);


sysStatus.query();


</g:evaluate>



And in the next series of code, you are still using "sysStatus", which is no longer present.



You might want "sysStatus" to be replaced by "jvar_system_status" your next evaluate code, something like this:



<j:while test="${jvar_system_status.next()}">


<div class="detail">


<div><span class="${jvar_system_status.getValue('u_icon').toLowerCase()}">System:</span>${jvar_system_status.getDisplayValue('u_system')}


</div>


<div><span class="detaillabel">Related Information:</span><g:no_escape>${jvar_system_status.u_related_information.getHTMLValue()}</g:no_escape>


</div>


</div>


</j:while>




Hope this would help ya!!


Thanks for your reply.   Originally I had it setup as you advised and displayed a blank section.




The issue I am encountering is when the html field contains     nbsp;




For example, if the html field's contents are:


find_real_file.png


The UI Page displays:


find_real_file.png




However if I remove the     from the html contents:


find_real_file.png


The UI Page displays:


find_real_file.png


nm13
Kilo Guru

In ServiceNow UI Page, you can use this ---       &#160;   ---- This wont give any error.

 

Kindly mark correct/helpful if it helped you in anyway. Thanks!