how to make hyperlink in catalog item variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 03:50 AM
I have custom table which stores 4 variable (var1, var2, var3, var4). var2 depends on var1, var3 depends on var1 and var2, var4 depends on var1 var2 and var3. var4 stores different URLs. Requirement: on click of URL respective page should be open in tab.
I have tried with macro variable and created new UI macro, but "document.getElementById("xxx").innerHTML" is not working.
Please let me know if any have idea.
- Labels:
-
Request Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 04:02 AM
Create the variable of type UI Page on catalog item.
And in UI Page there you can create the link using html tag.
Catalog Item Variable of Type Ui page
Ui Page where I have created the link.
Result on catalog Item
Thanks,
Shrutika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 06:53 AM
Thanks for reply.
how to pass URL from client side to UI macro or UI page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 04:21 AM
This is possible by setting the "glide.ui.escape_text" system property to false. Once you make this property false, you can use a label type variable and write your a href tag in the Help Text section .
<a href="https://www.google.com">More information</a>
But this is not advisable since it opens the instance to cross site scripting attacks. Please find below link for your reference
https://community.servicenow.com/community?id=community_question&sys_id=f00fcba1dbdcdbc01dcaf3231f9619f4
The safest way is to create a UI macro for this purpose and this also ensures it is compatible to your service portal widget.
Thank you.
Please hit Correct/helpful depending on impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2020 07:03 AM
Thanks for reply.
client script is not working at line "document.getElementById("myAnchor").innerHTML"
UI macro:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<body>
<div >
<a id="myAnchor" href="#myAnchor" target='_blank'>test</a>
</div>
</body>
</html>
</j:jelly>
catalog client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert("first");
//Type appropriate comment here, and begin script below
document.getElementById("myAnchor").innerHTML = "https://devXXXXX.service-now.com/incident.do?sys_id=cbbd2f004f63630009a2b4a18110c72d&sysparm_view=&sysparm_record_target=incident&sysparm_record_row=2&sysparm_record_list=active%3Dtrue%5EORDERBYDESCsys_updated_on&sysparm_record_rows=9238";
alert("last");
}
Please suggest me if anyone knows.