Variable type URL - how to render as a clickable link

Baggies
Kilo Guru

I have a requirement for a URL type variable to render as a clickable link when displayed in the Variable Editor on the Item or Catalog Task form. Can this be done? I see there is a Variable Type of URL. My assumption is that when the User enters as URL in this variable (eg , https://community.servicenow.com/   ) it will show as   a link in the variable editor.

I have searched the forums, and can only find suggestions for adding macros, or creating UI pages. I am sure it must be simpler than that, or there wouldn't be a URL type.

Any suggestion would be greatly appreciated. Thanks.

10 REPLIES 10

Yes, I went down the path of an earlier response from this link: URL type variable on catalog form


You create a new variable, type is Macro with Label. The Macro points to the UI Macro in the above link, it's all there.


The only issue I had in the above link was that the link didn't open in a new tab, you just have to add the html code ( target="_blank") to the end of the link in the UI Macro for that part. Here's the variable, the macro is below. Once you use it, you'll see how easy it is.


url variable.JPG




Here's the UI Macro


Name: Google_Macro


Description:



XML:

<?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 id="sample_check"> <font>BYOD </font>


<a href="https://www.google.com" target="_blank"><b><font color="Blue">here</font></b></a><font> to surf google.</font>


</div>


</body>


</html>


</j:jelly>


Patrick Quinlan
Giga Guru

This post has been very helpful...although I need a little more information. I am trying to display a dynamic link. The actual URL is captured in another variable on the Catalog Task. How do I call the UI macro and pass the URL to it so that the link renders and points to the correct address?

@Patrick Quinlan did you find a solution? we are having similar requirement.

Hi nt,

 

Did you find a solution for this please?

John Zhang1
Kilo Patron
Kilo Patron

There are two ways to create variable with a clickable link: 1) Label type by adding a link to annotation; 2) UI Page with a link

find_real_file.png