- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2016 07:19 AM
I need to fetch the URL, when i select an item from the category.
function onload()
{
var href = window.location.href;
alert('href ' + href);
var what = getTopWindow().location.toString();
alert('TW ' + what);
}
These alerts works for catalog items but does not display when i load the item on service portal.
Thanks and Regards
Jayanth
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016 02:14 AM
Hi,
If you don't find window object then try using 'this' object.
example:
this.location.href
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2016 07:29 AM
Hi Jayanth,
var currentUrl = window.location.href
alert(currentUrl);
Above code has worked before for me. However I really would suggest that you use $sp.getParameter('your_parameter'); in your widget. It is a lot cleaner however I might be suggesting this method without really understanding your problem. If you are attempting to pass information between your "url"/backend to the widget this method should be utilized. There are a lot of Out of Box widgets taking advantage of that method if you need more assistance please let me know and I will be happy to help.
Best Regards,
Philip Engles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2016 07:36 AM
1. Server Side - You can use:
getMenuHREF(GlideRecord): String | Returns the (?id=) portion of the URL based on the sp_menu type. |
2. Client Side - Though I have never tried it out, but in the example for $sp.getCatalogItem(), you will see servicenow using "spUtil.getURL('sc_cat_item')".
Hope this helps.
- Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016 02:14 AM
Hi,
If you don't find window object then try using 'this' object.
example:
this.location.href
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2017 07:59 AM
Did this actually work in service portal?
EDIT: Holy Helena, it does! I've been searching for a documented work-around for URL access for _ever_. Is this not documented anywhere, or have I just blatantly missed it?