Rogers Cadenhe1
Giga Guru

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.

Comments
harshvardhan_11
Giga Expert

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.

Rogers Cadenhe1
Giga Guru

Can I see your code? What I wrote has been working in Jakarta and Kingston.

Version history
Last update:
‎04-22-2018 09:26 AM
Updated by: