- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 10:04 PM
Hi All,
I have designed a small UI Page and the script in it contains a link , clicking on it will take the user to a specific page.
I have hard coded the URL in the script within the HREF tag. But i want this link to be dynamic.
For example:- If this link is clicked in the test instance then the expected page which should open should be of test instance and so on for other instances respectively.
Any help here?
Thanks,
Shahid
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 10:58 PM
Hi Shahid,
You can do it in server sided without creating any property or server side calls.
I am providing you an example of ui page.
HTML of the UI page:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="javascript:showLink()" >Dynamic link</a>
</j:jelly>
Client script of the UI page:
function showLink()
{
var url = window.location.href;
var str = url.split(".")[0];
window.open(str+'.service-now.com');
}
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 10:31 PM
well you can put the link like this.
<a href="/<link of your page>">Link</a>
or if you really need the url of the current instance you can use this
gs.getProperty('glide.servlet.uri')
This will give you an output like https://<your-instance-name>.service-now.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 10:46 PM
Hi Prithviaj,
I have used this in my client side and server side scripts but i dont have much knowledge about jelly scripting.
Please have a look at my reply to Ankur and let me know if you can help.
Thanks and RGDS,
Shahid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 10:58 PM
Hi Shahid,
You can do it in server sided without creating any property or server side calls.
I am providing you an example of ui page.
HTML of the UI page:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a href="javascript:showLink()" >Dynamic link</a>
</j:jelly>
Client script of the UI page:
function showLink()
{
var url = window.location.href;
var str = url.split(".")[0];
window.open(str+'.service-now.com');
}
Thanks,
Mihir