Show hyperlink in info message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 08:33 AM
Hello,
on a catalog item i have an onChange catalog client script that is showing a message below a variable based on the variable selected from the select box.
I am trying to add a hyper link to an external website in this message -
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == 1)
{
g_form.showFieldMsg('privilege_id_password_rotation_options', '3/6/9 days password rotation on Checkout Expiration. Please Reference: https://www.google.com', 'info');
I am looking to make https://www.google.com a link in this message.
Is this possible?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2022 10:41 PM
Hello
Please find below article
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2022 11:20 PM
Hello,
You can add this to addInfoMessage though both in client and server scripts, please have a look
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0691931
https://www.servicenow.com/community/it-service-management-forum/add-link-in-info-message/m-p/836336
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2022 11:46 PM
Hello,
We cannot show hyperlink message on showfieldmsg however we can do it in addinfo message, please use the below code:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == 1)
{
g_form.addInfoMessage("3/6/9 days password rotation on Checkout Expiration. Please Reference:<a href = 'https://www.google.com''>https://www.google.com'</a>");
}
}
Please mark my answer correct base on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 05:26 PM - edited 10-20-2023 05:26 PM
Hey @Sandy7 - we had a similar issue. I wrote out some code below that should do the trick for you.
Please note that it must be done in an addInfoMessage, since showFieldMsg won't allow hyperlinks.
// build the link and clickable text, set it equal to a variable
var link = '<a href="https://www.google.com" target="_blank">https://www.google.com</a>
// add the info message, using strings and the link variable that was built above
g_form.addInfoMessage('3/6/9 days password rotation on Checkout Expiration. Please Reference: ' + link);
You can set a variable called 'link' equal to the hyperlink text, and then use it in your info message.
For an explanation on the code, you can see how we did it here.