Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

GlideURI- Scoped

The GlideURI API provides methods to handle URI parameters in a scoped application.

Note: Do not use the GlideURI API in scripts that are executed during export or in background jobs.

For more information on using URIs:

See also: GlideURI - Global .

Parent Topic:Server API reference

Scoped GlideURI - GlideURI()

Instantiates a GlideURI object.

NameTypeDescription
None  

Scoped GlideURI - get(String name)

Returns the value of the specified parameter.

NameTypeDescription
nameStringThe parameter name.
TypeDescription
StringThe value for the specified parameter.
var gURI = new GlideURI();
gURI.set('sysparm_query', 'priority=2^active=true' );
var fileString = gURI.get('sysparm_query');
gs.info(fileString);

Output:

priority=2^active=true

Scoped GlideURI - getFileFromPath()

Returns the file name portion of the URI.

NameTypeDescription
None  
TypeDescription
StringThe file name portion of the URI.
var gURI = new GlideURI();

var fileString = gURI.getFileFromPath();
gs.info(fileString);

Scoped GlideURI - set(String name, String value)

Sets the specified parameter to the specified value.

NameTypeDescription
nameStringThe parameter name.
valueStringThe value.
TypeDescription
None 
var gURI = new GlideURI();
gURI.set('sysparm_query', 'priority=2^active=true' );
var fileString = gURI.get('sysparm_query');
gs.info(fileString);

Output:

priority=2^active=true

Scoped GlideURI - toString(String path)

Reconstructs the URI string and performs the proper URL encoding by converting non-valid characters to their URL code. For example, converting & to '%26'.

Parameters set with the set() method are encoded with the URI as well.

NameTypeDescription
pathStringThe base portion of the system URL to which the URI is appended.
TypeDescription
StringThe URL.
var gURI = new GlideURI();
fileString = gURI.toString('https://<your instance>.service-now.com/navpage.do');