Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more 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();

 

paulmorris
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