HTML field not rendering properly

eduzol
Tera Contributor

Hi Team,

I am trying to render an image dynamically on ServiceNow HTML field.

To accomplish this, I set up HTML field value to:

<div> <img src="my_image_url"> </div>

However, I get the following result:

find_real_file.png

As you can see I get html text instead of rendered image.

Is there any additional configuration I need to do?

Thank you,

Regards.

1 ACCEPTED SOLUTION

eduzol
Tera Contributor

I actually ended up contacting HI support. I would like to share with the community in case they face the same issue:


Issue happens when "Field type changed on a field (storage alias ) after creation of field as an update does not cascade change in TYPE to the DB".



Example Field Type was String , Max Length = 255 at the time creation later modified to HTML or String , 4000 at the dictionary level , but in the DB it still shows varchar ( 255 ) .



To fix this issue you can either re create the field on affected instance or ask DBA to change field type.



Hope you find it useful.


View solution in original post

6 REPLIES 6

antin_s
ServiceNow Employee
ServiceNow Employee

Hi Eduardo,



You can use 'Image' field type instead of 'HTML' field type. HTML type is meant for HTML editing.



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


eduzol
Tera Contributor

Hello antin.s . Thank you so much for following up.


We are rendering other HTML elements, like hyperlink as part of our HTML field.


However HTML is not rendering, it displays as text.


Same code works in other instances. Any clues?


antin_s
ServiceNow Employee
ServiceNow Employee

Can you please share some code snippets?


antin_s
ServiceNow Employee
ServiceNow Employee

Also, some snapshots if possible.