How to set URL in widget dynamically for each instance via sys property

Aditya1204
Tera Contributor

We have  created widget. In html . Written url and their href link. And then moved to other instances. But when clone and upgrades happens. It's url automatically gets changes . Pointing towards other instance. How to make it dynamically via system properties 

1 ACCEPTED SOLUTION

Please dont create this system properties in your instance. these system properties are managed by servicenow directly. 
you can use background script to get output of that system properties in different instances

View solution in original post

5 REPLIES 5

SP22
Mega Sage
Mega Sage

Hi @Aditya1204,

You can use gs.getProperty("glide.servlet.uri") to get the URL of instance, like https://dev.service-now.com/ in your server side script and store it in the data variable like,

 

 data.inst_url = gs.getProperty("glide.servlet.uri") + "esc?id=services";

 

 

Then in your HTML you can use this like,

 

<a href="{{c.data.inst_url}}" style="margin: 10px 0;white-space: pre;">Get in touch with your Manager</a>

 

 

This will take care of instance name dynamically.

 

Thanks
SP

Aditya1204
Tera Contributor

Will check and let you know.

 

Thanks for quick help

Please dont create this system properties in your instance. these system properties are managed by servicenow directly. 
you can use background script to get output of that system properties in different instances

Aditya1204
Tera Contributor

HI SP22..

 

I have to display report url link after https://dev.service-now.com/what should I add in place of 

"esc?id=services";