GlideList \(Next Experience\) - Client

concept brazil Updated Sep 10, 2026 9 min read GlideListClientAPINEx.md
Raw file servicenow.com

The GlideList API provides methods to customize lists in the Next Experience UI Framework.

This API enables adding GlideList functionality to a button in the Workspace Experience UI. Use the g_list variable to call each method.

To add a button, create a list action and add GlideList method calls into the Client Script field onClick{} method. For instructions, see Use the client GlideList API in the Workspace Experience UI.

[Omitted image "add-api-glidelist-workspace.png"] Alt text: GlideList method calls in the Client Script field.

Note: Each method must be used with the refresh() method, with the exceptions of sort() and sortDescending() methods.

The methods in this API are based on GlideList2. The following GlideList2 methods are not supported in the Next Experience framework and cause an error in the console log:

  • isUserList()
  • setFirstRow()
  • showHideGroups()
  • showHideList()
  • toggleList()
  • toggleListNoPref()

Parent Topic:Client Next Experience API reference

GlideList (Next Experience) - addFilter(String filter)

Adds a single term to the list query filter.

See also setFilter().

Name Type Description
filter String Encoded query string in standard Glide format. See Encoded query strings.
Type Description
None

The following example shows how to retrieve a list of active records and refresh the page.

JavaScript
g_list.addFilter("active=true");g_list.refresh();

GlideList (Next Experience) - getChecked()

Returns a comma-separated list of the sys_ids for the items that are checked in the associated list.

Name Type Description
None
Type Description
String Comma-separated list of the sys_ids for the items that are checked in the list. Does not check to determine that the items returned are allowed to be executed.

The following example shows how to get the sys_ids of each record selected in a list.

JavaScript
var myChecked = g_list.getChecked();alert(myChecked);g_list.refresh();

Output in an alert box (empty if no records are selected):

Text
079893e6b733330059128ac7ee11a967, 4fca6d45b7131010f03e9b7ade11a9d3, 5c460fbf1bd0011079e52131604bcbd9

GlideList (Next Experience) - getFixedQuery()

Returns the fixed query.

A fixed query is the part of the query that cannot be removed from the breadcrumb (i.e., it is fixed for the user).

Apply this method under Related List Actions in the Workspace Experience UI. For instructions, see Use the client GlideList API in the Workspace Experience UI.

Name Type Description
None
Type Description
String The fixed query string for the list.

The following example shows how to display a fixed query with a debug message in the browser console log.

JavaScript
console.log(g_list.getFixedQuery() + " debug message");

The output after clicking the button on the Child Incidents tab in an Incident record.

Text
parent_incident=46f1784ba9fe19810018aa27fbb23482 debug message

GlideList (Next Experience) - getGroupBy()

Returns the field or comma-separated list of fields that are used to group the list.

See also:

Name Type Description
None
Type Description
String The field or comma-separated list of fields that are used to group the list.

The following example shows how to get field groupBy values of the current list view.

JavaScript
var grpdBy = g_list.getGroupBy();alert("The list is grouped by " + grpdBy);g_list.refresh();

Output in an alert box for a list grouped by priority:

Text
The list is grouped by ^GROUPBYpriority

GlideList (Next Experience) - getListName()

Returns the name of the list, which is usually the table name.

Name Type Description
None
Type Description
String The list name (usually the table name).

The following example shows how to call the method.

JavaScript
g_list.getListName();

GlideList (Next Experience) - getOrderBy()

Returns the first field used to order the list.

See also:

Name Type Description
None
Type Description
String The field by which to order the list. Empty if the list is not ordered.

The following example shows how to get field orderBy values of the current list view.

JavaScript
var orderBy = g_list.getOrderBy();	alert("The list is ordered by " + orderBy);g_list.refresh();

Output in an alert box for a list ordered by priority:

Text
The list is ordered by ^ORDERBYDESCpriority

GlideList (Next Experience) - getParentTable()

Returns the name of the parent table for a related list (the table associated with the form).

Name Type Description
None
Type Description
String The parent table name.

The following example shows how to call the method.

JavaScript
g_list.getParentTable();g_list.refresh();

GlideList (Next Experience) - getQuery(Object)

Returns the encoded query string for the list.

See also:

Name

Type

Description

<object>

Object

Optional. By default, this method includes orderBy, groupBy, and fixed query in the results. You can set object properties to restrict results to one or more of the three available options.

<object>.orderBy

Boolean

Optional. Flag that indicates whether to include orderBy in results.Valid values:

  • true: Include orderBy in results.
  • false: Do not include orderBy in results.

Default: false

<object>.groupBy

Boolean

Optional. Flag that indicates whether to include groupBy in results.Valid values:

  • true: Include groupBy in results.
  • false: Do not include groupBy in results.

Default: false

<object>.fixed

Boolean

Optional. Flag that indicates whether to include fixed query in results.Valid values:

  • true: Include fixed query in results.
  • false: Do not include fixed query in results.

Default: false

|Type|Description| |----|-----------| |String|Encoded query string for the list.|

The following example shows how to display the list encoded query with a debug message in the browser console log.

JavaScript
var myQuery = g_list.getQuery();console.log(myQuery + " message");

Output:

Text
active=false^EQ message

GlideList (Next Experience) - getRelated()

Returns the related list field that associates the related list to the parent form.

Name Type Description
None
Type Description
String Field that connects the list to the parent form.

The following example shows how to call the method.

JavaScript
g_list.getRelated();

GlideList (Next Experience) - getTableName()

Returns the table name for the list.

Name Type Description
None
Type Description
String Returns the table name for the list.

The following example shows how to display the list name for the current view.

JavaScript
var listName = g_list.getListName();alert("The current list name is " + listName);g_list.refresh();

Output in an alert box:

Text
The current list name is incident

GlideList (Next Experience) - getTitle()

Returns the list title.

Name Type Description
None
Type Description
String The list title.

The following example shows how to call the method.

JavaScript
g_list.getTitle();

GlideList (Next Experience) - getView()

Returns the view used to display the list.

Name Type Description
None
Type Description
String The name of the view.

The following example shows how to call the method.

JavaScript
g_list.getView();

GlideList (Next Experience) - refresh(Number firstRow)

Refreshes the list. The orderBy part of the list filter is ignored so that the list uses its natural ordering when it is refreshed.

Name

Type

Description

firstRow

Number

The first row to appear in the list.Default: First row of the current view.

|Type|Description| |----|-----------| |None| |

The following example shows how to call the method.

JavaScript
g_list.addFilter("active=true");g_list.refresh();

GlideList (Next Experience) - refreshWithOrderBy(Number firstRow)

Refreshes the list. The orderBy part of the list filter is included if it is specified for the list.

Name

Type

Description

firstRow

Number

The first row to appear in the list.Default: First row of the current view.

|Type|Description| |----|-----------| |None| |

The following example shows how to call the method.

JavaScript
g_list.refreshWithOrderBy();

GlideList (Next Experience) - setFilter(String filter)

Sets the encoded query string for the list, ignoring the orderBy and groupBy parts of the query string.

See also addFilter().

Name Type Description
filter String Encoded query string in standard Glide format. See Encoded query strings.
Type Description
None

The following example shows how to restrict list results to active records.

JavaScript
g_list.setFilter("active=true");g_list.refresh();

GlideList (Next Experience) - setGroupBy(String groupBy)

Sets the list groupBy criteria for a single field.

See also:

Name Type Description
groupBy String The groupBy criteria for the list.
Type Description
None

The following example shows how to group listed records by Caller ID.

JavaScript
g_list.setGroupBy("caller_id");g_list.refresh();

GlideList (Next Experience) - setOrderBy(String orderBy)

Sets the orderBy criteria for the list.

For a single order by field, use orderBy field or orderByDesc field. For multiple fields, use orderByField1^orderByField2^orderByField3. orderBy specifies ascending order and orderByDesc specifies descending. These prefix strings are optional. If not specified, orderBy is the default order.

See also:

Name Type Description
orderBy String Single or multiple orderBy fields.
Type Description
None

The following example shows how to order the list by the value of the Priority field.

JavaScript
g_list.setOrderBy("priority");g_list.refresh();

GlideList (Next Experience) - setRowsPerPage(Number rows)

Sets the number of rows per page to display.

Name Type Description
rows Number The number of rows to display.
Type Description
None

The following example shows how to limit results to 50 rows per page.

JavaScript
g_list.setRowsPerPage(50);refresh();

GlideList (Next Experience) - sort(String field)

Sorts the list in ascending order and sets the field as an orderBy column.

See also:

Note: This method does not require the refresh() method.

Name Type Description
field String Field to use to sort the list.
Type Description
None

The following example shows how to sort results by the Number field.

JavaScript
g_list.sort("number");

GlideList (Next Experience) - sortDescending(String field, Number amount)

Sorts a single field in the list in descending order and sets the field as an orderByDescField column.

See also:

Note: This method does not require the refresh() method.

Name Type Description
field String Field to use to sort the list.
Type Description
None

The following example shows how to sort results by the Number field in descending order.

JavaScript
g_list.sortDescending("number");
Search documentation
Search document titles and file paths on the brazil branch