Hyperlink in Catalog Item

Chirag Jain3
Tera Expert

Hi,

 

I have a requirement that whenever the "A" choice is selected on the variable in the catalog item on the service portal, we should display a few hyperlinks displayed as below:

Please review below confluence articles before submitting the request for access:

1) Heading of the 1st page

2) Heading of the 2nd page.

 

Any help on this how we can achieve this, 

3 REPLIES 3

Martin Ivanov
Giga Sage
Giga Sage

Hi. You can achieve this with catalog client script, onchange of your variable, showFieldMsg, that will display the message. To embed the hyperlink in your text, use <href> tag. Community does not allow posting hyperlinks, but you can do your research on that.


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Sai Kumar B
Mega Sage
Mega Sage

@Chirag Jain3 

showFieldMessage() function doesn't support HTML. If you want to add a hyperlink, you have to go ahead with addInfoMessage().

Alternatively, you can follow below link:
To Create hyperlink in Client scripts, showFieldMsg

 

OR

 

1.) Create two Rich-text label variables

2.) Create an onChange client script on the choice variable and Set those label variables with hyperlinks using g_form.setLabelOf('variable_name', '<pass the HTML here');

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Chirag Jain3 ,

Hope you are doing fine.

You can achive the same by creating the variables with type Rich Text Lable and providing the hyperlink on the same . Please find below sample variable for the same.

AmitGujarathi_0-1665477566889.png

 

This lable will be shown as clickable link on the portal as shown in the below screenshot

AmitGujarathi_1-1665477630166.png

Now you can write onChange catalog client script to hide or show this variable based on the condition as shown below

// Syntax to Hide/Show variables 
g_form.setDisplay('VARIABLE_NAME',false); 

 

Please mark correct / helpful if it helped to resolve your query.

 

Regards,

Amit Gujarathi

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi