Need to include instance url in HTML of widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 12:14 AM
Hi all I have configured a widget, where I need to use relative URL means instance name should come dynamically.
If you can see Get in touch with your local UHD is the hyperlink, but in backend I have given hardcoded url but I want to give it dynamically
<a href="https://servicenow-dev.i.instance.com/esc?id=services" style="margin: 10px 0;white-space: pre;">Get in touch with your local UHD</a>
Please guide How I can use it for dynamic use.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 12:35 AM - edited 11-24-2023 12:37 AM
HI @pandeyved
You can use gs.getProperty("glide.servlet.uri") to get the URL of instance, like https://serv-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 local UHD</a>
This will take care of instance name dynamically.
You can also use other sys_property called instance_name to get just the name of the instance.
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 01:05 AM
Hello,
No need to define any property, you can directly give link like below
<a href="/esc?id=services" style="margin: 10px 0;white-space: pre;">Get in touch with your local UHD</a>
or you can use ng-href as well
<a ng-href="?id=services">${Home}</a>
Try both, I think it should work.
Regards,
Musab