Want to get the URL of the current page in the portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 02:37 AM
I wanted to get the current url of thecatalog portal and to use the url in reference qualifier to get the sys_id of case
Sample Url: instance.service-now.com/portal_name&sys_id= &case_id
Now in reference qualifier of a catalog item needs to get the url and filters the value based on case _id.
Anyone please share your ideas?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 02:51 AM
Hi Akila,
you can directly get the url in the script include function and within that use this script to get the url parameter value
var url = gs.action.getGlideURI().toString();
to get value of case_id use this
var caseId = gs.action.getGlideURI().getMap().get('case_id');
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 03:49 AM
Hi Ankur,
I have tried the above script but it was returning "null' value;
below is my script;
javascript:var catsysID = current.cat_item;
var cusAccount= gs.action.getGlideURI().getMap().get('case_id');
gs.log("getParam URL"+cusAccount);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 03:55 AM
Hi Akila,
Can you try to print the url first to check whether that url parameter is present or not?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 03:56 AM
Hi,
You can get portal current page url like this.
var currenturl=this.location.href;
Refer below link.it will help you.
Mark as correct/helpful,If you find any help worthy.