- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-22-2018 09:26 AM
I needed to retrieve the current URL and one of its parameters in a client script in a scoped application.
Scoped application don't have access to the window object, so it can't be used for this purpose.
After experimenting with no success on many other approaches, I found out about the GlideURL class.
Here's how I retrieved the URL and sysparm_target parameter in the client script:
var glide_url = new GlideURL();
glide_url.setFromCurrent();
var target = glide_url.getParam("sysparm_target");
The documentation for GlideURL doesn't include setFromCurrent(), which pulls information about the current URL into the newly created GlideURL object.
If anyone knows about other useful function calls in GlideURL, please share them in the comments.
- 3,589 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
As suggested I tried to use the above script in scoped application, but it threw an error in console saying
ReferenceError: GlideURL is not defined
Can you please update if any other functionality to be added.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can I see your code? What I wrote has been working in Jakarta and Kingston.