How to create dynamic hyper link on service catalog

varunp
Tera Guru

I am building the catalog forms where based on requester dept link will get populated and this should be the clickable.

I have written a script to populate the URL but that URL is clickable it s just a text URL. Any idea how to make is a hyperlink.

6 REPLIES 6

Jace Benson
Mega Sage

Can you share what you're doing specifically.   e.g.   I have a text field, or I'm writing to the dom or I'm using a ui macro etc etc.


Nitin_NOW
Tera Guru

Could you please post your script here so that we can take a look?



Regards!


I wrote one catalog client script



OnChange Script :



var req = g_form.getReference('requested_for');


if((req.u_company) == "abc"){


g_form.setValue('label', 'http://google.com');


else


g_form.setValue('label', 'http://yahoo.com');


}



I have created one label field. I don't know which type of field should I select. I tried with many field types, still, the link is not clickable.


So writing a url to a label won't make it a link.   You'd need to write html to do that.



Here's what I'd recomend.


Create a UI Macro and add that to your item, have that render the link given based on the other variables.


If you need the same on the service portal, you'll also have to make a widget to do the same.