Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the hyperlink in Onchange Catalog client script?

Suvedha2
Tera Contributor

Hi all,

 

I need to get the hyperlink in Onchange catalog client script in which it should have another catalog item. It is the variable set, So i am not able to use the macro, UI Page. Is there a way can we achieve it in ErrorBox/ showfieldmsg.

 

Thanks,

Suvedha

 

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

You can use HTML tags in g_form.addInfoMessage or g_form.addErrorMessage

g_form.addInfoMessage("Please <a href = '/incident_list.do'>Click</a>");
g_form.addErrorMessage("Please <a href = '/incident_list.do'>Click</a>");

Hi Brad,

 

Is there a way can we achieve it by UI page as it is we are trying to get in variable set.

 

Thanks,

Suvedha

@Suvedha2 @Suvedha Vignesh  You can try by creating a variable type"Rich Text Lable" and onchange client script you can fill the value as HTML. check below image and video i have created.
test variable set having one yes/no variable and one rich text label

PranaKrushna_0-1718993257506.png

client script: when its changing to yes, i am setting the rich text label to a hyper link 

PranaKrushna_1-1718993328600.png

 

Check the gif attached for the result.

Mark it helpful if it works for you.