GlideURI - Scoped

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:3分
  • The GlideURI API provides methods to handle URI parameters in a scoped application.

    注:
    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 .

    Scoped GlideURI - GlideURI()

    Instantiates a GlideURI object.

    表 : 1. Parameters
    Name Type Description
    None

    Scoped GlideURI - get(String name)

    Returns the value of the specified parameter.

    表 : 2. Parameters
    Name Type Description
    name String The parameter name.
    表 : 3. Returns
    Type Description
    String The 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.

    表 : 4. Parameters
    Name Type Description
    None
    表 : 5. Returns
    Type Description
    String The 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.

    表 : 6. Parameters
    Name Type Description
    name String The parameter name.
    value String The value.
    表 : 7. Returns
    Type Description
    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.

    表 : 8. Parameters
    Name Type Description
    path String The base portion of the system URL to which the URI is appended.
    表 : 9. Returns
    Type Description
    String The URL.
    var gURI = new GlideURI();
    fileString = gURI.toString('https://<your instance>.service-now.com/navpage.do');