The CreatorCon Call for Content is officially open! Get started here.

Can we add a HTML link in showfieldmsg()

Rachael12
Tera Contributor

Hello, 

I want to a HTML link below a field and I was trying to do it through showfieldmsg() but unable to achieve.
I am able to achieve the requirement through macro+widget but there is a lot of distance between the message and field and client does not want that.

So, is it possible to achieve through  showfieldmsg?

Thanks in advance

9 REPLIES 9

Hi Rachael,

I'm not familiar with that form, is that a catalog item / record producer or a table? 

Let me know when you get a chance.

Thanks!

MB

Hi,

 

How can we do this on the record producer?

How do I do this on a Catalog Item?

I would propose an improvement - you can user final HTML formatted message there, ideally get with getMessage("message.key"), and unescape it this way:

g_form.showFieldMsg('impact', 'text with html link - it will be unescaped later in snippet', 'info', false);

var fieldMessage = gel('incident.impact_fieldmsg').getElementsByClassName("notification")[0];

fieldMessage.innerHTML = fieldMessage.innerHTML.unescapeHTML();

 

The SN Nerd
Giga Sage
Giga Sage

Have you considered making the field itself a link? See the example below with the Priority field:

find_real_file.png

Click on Priority opens a link in a new window.

find_real_file.png

The only other way is as MB suggested.

It does involve DOM manipulation, which will negatively impact Health Scan results on your instance.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022