How to add a link(url) by using g_form.showFieldMessage()?

Bharath kumar6
Tera Expert

I need a link to be displayed if a user select "No" from Yes/No field.

How do I achieve this?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

g_form.showFieldMessage() -> doesn't support showing links

you can use info message to show the link

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

9 REPLIES 9

No bud, lots of discussions have happened on this but no good solution ever came out.

You can add a link to the label of the field but that will always be present regardless of the value selected.

Alert also wont support hyperlink.

You can try creating a ui page and trigger that on change and add link on the ui page. That is the closest you can get to this requirement.

-Anurag

okay.

can you please explain a bit on this - "You can try creating a ui page and trigger that on change and add link on the ui page. That is the closest you can get to this requirement."

Here it is,

Create a UI page like below

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="https://www.google.com" target="_blank">Link</a>
</j:jelly>

find_real_file.png

On Change Client Script to run this when the value selected is NO

var gm = new GlideModal("Test Page For Comm");
gm.setTitle('Show title'); // Add meaningful title
gm.setWidth(550); //Adjust accordingly
//Opens the dialog
gm.render();

Result:

find_real_file.png

 

-Anurag

-Anurag

this does not work on service portal

This is a very useful trick to know.  Thanks!