GlideList2 (g_list) - Client

GlideList2 is a JavaScript class used to customize (v2) lists.

The variable g_list is used to access a specified list object. The g_list variable is not available to the related lists form link UI action. It is available to the lists form link UI action.

These methods are used in UI Context Menus and UI Actions.

GlideList2 - addFilter(String filter)

Adds a single term to the list query filter.

Table 1. Parameters
Name Type Description
filter String Query string condition to add.
Table 2. Returns
TypeDescription
void
g_list.addfilter("active=true");

GlideList2 - get(Object DOMelement)

Returns the GlideList2 object for the list that contains the specified item.

Table 3. Parameters
Name Type Description
DOMelement Object The DOM element ID for the list for which you want the GlideList2 object.
Table 4. Returns
TypeDescription
ObjectThe GlideList2 object or null if not found.

GlideList2 - get(String ListID)

Returns the GlideList2 object for the list specified.

Table 5. Parameters
Name Type Description
ListID String The list ID for which you want the GlideList2 object.
Table 6. Returns
TypeDescription
ObjectThe GlideList2 object or null if not found.

GlideList2 - getChecked()

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

Table 7. Parameters
Name Type Description
none
Table 8. Returns
TypeDescription
StringComma-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.

GlideList2 - getFixedQuery()

Returns the sysparm_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). It is specified by including a sysparm_fixed_query parameter for the application module.

Table 9. Parameters
Name Type Description
none
Table 10. Returns
TypeDescription
StringThe fixed query string for the list.

GlideList2 - getGroupBy()

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

Table 11. Parameters
Name Type Description
none
Table 12. Returns
TypeDescription
StringThe field or comma-separated list of fields that are used to group the list.

GlideList2 - getListName()

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

Table 13. Parameters
Name Type Description
none
Table 14. Returns
TypeDescription
StringThe list name (usually the table name).

GlideList2 - getOrderBy()

Returns the first field used to order the list.

Table 15. Parameters
Name Type Description
none
Table 16. Returns
TypeDescription
StringThe field used for order, or a blank.

GlideList2 - getParentTable()

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

Table 17. Parameters
Name Type Description
none
Table 18. Returns
TypeDescription
StringThe parent table name.

GlideList2 - getQuery(Boolean orderBy, Boolean groupBy, Boolean fixed, Boolean all)

Returns the encoded query string for the list.

Table 19. Parameters
Name Type Description
orderBy Boolean (Optional) If true, includes the orderBy in the encoded query string.
groupBy Boolean (Optional) If true, includes the groupBy in the encoded query string.
fixed Boolean (Optional) If true, includes fixed query in the encoded query string.
all Boolean (Optional) If true, includes orderBy, groupBy and fixed query.
Table 20. Returns
TypeDescription
StringEncoded query string for the list.

GlideList2 - getRelated()

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

Table 21. Parameters
Name Type Description
none
Table 22. Returns
TypeDescription
StringField that connects the list to the parent form.

GlideList2 - getTableName()

Returns the table name for the list.

Table 23. Parameters
Name Type Description
none
Table 24. Returns
TypeDescription
StringReturns the table name for the list.

GlideList2 - getTitle()

Returns the list title.

Table 25. Parameters
Name Type Description
none
Table 26. Returns
TypeDescription
StringThe list title.

GlideList2 - getView()

Returns the view used to display the list.

Table 27. Parameters
Name Type Description
none
Table 28. Returns
TypeDescription
StringThe name of the view.

GlideList2 - isUserList()

Returns true if the list has been personalized by the user by choosing the list mechanic and changing the list layout.

Table 29. Parameters
Name Type Description
none
Table 30. Returns
TypeDescription
BooleanTrue if the list layout has been changed.

GlideList2 - refresh(Number firstRow, String additionalParms)

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

Table 31. Parameters
Name Type Description
firstRow Number (Optional) The first row to display in the list. If not specified, the current list's first row is used.
additionalParms String (Optional) name-value pairs that are submitted with the list refresh request.
Table 32. Returns
TypeDescription
void

GlideList2 - refreshWithOrderBy(Number firstRow, String description)

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

Table 33. Parameters
Name Type Description
firstRow Number (Optional) The first row to display in the list.
description String (Optional) name=value pairs that are submitted with the list refresh request.
Table 34. Returns
TypeDescription
void

GlideList2 - setFilter(String filter)

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

Table 35. Parameters
Name Type Description
filter String Encoded query string.
Table 36. Returns
TypeDescription
void

GlideList2 - setFilterAndRefresh(String filter)

Sets the encoded query string for the list, including the orderBy and groupBy if specified, and then refreshes the list using the new filter.

Table 37. Parameters
Name Type Description
filter String Encoded query string.
Table 38. Returns
TypeDescription
void

GlideList2 - setFirstRow(Number rowNum)

Sets the first row that will be displayed in the list when the list is refreshed.

Table 39. Parameters
Name Type Description
rowNum Number Row number of the first row to be displayed.
Table 40. Returns
TypeDescription
void

GlideList2 - setGroupBy(String groupBy)

Sets the groupBy criteria for the list, for a single field or multiple fields.

For a single field, use field or groupByField. The groupBy prefix is optional. For multiple fields use field1^field2^field3 or groupByField1^groupByField2^groupByField3.

Table 41. Parameters
Name Type Description
groupBy String The groupBy criteria for the list.
Table 42. Returns
TypeDescription
void

GlideList2 - setOrderBy(String orderBy)

Sets the orderBy criteria for the list.

For a single order by field use orderBy field or orderByDescField. 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 assumed.

Table 43. Parameters
Name Type Description
orderBy String Single or multiple order by fields.
Table 44. Returns
TypeDescription
void

GlideList2 - setRowsPerPage(Number rows)

Sets the number of rows per page to display.

Table 45. Parameters
Name Type Description
rows Number The number of rows to display
Table 46. Returns
TypeDescription
void

GlideList2 - showHideGroups(Boolean showFlag)

Displays or hides all of the groups within the list and saves the current collapsed/expanded state of the groups as a user preference.

Table 47. Parameters
Name Type Description
showFlag Boolean If true, displays the groups within the list.
Table 48. Returns
TypeDescription
void

GlideList2 - showHideList(Boolean showFlag)

Displays or hides the list and saves the current collapsed/expanded state of the list as a user preference.

Table 49. Parameters
Name Type Description
showFlag Boolean If true, displays the list.
Table 50. Returns
TypeDescription
void

GlideList2 - sort(String field)

Sorts the list in ascending order and saves the choice.

Table 51. Parameters
Name Type Description
field String Specifies the field used to sort the list.
Table 52. Returns
TypeDescription
void

GlideList2 - sortDescending(String field, Number amount)

Sorts the list in descending order and saves the choice.

Table 53. Parameters
Name Type Description
field String Specifies the field used to sort the list.
Table 54. Returns
TypeDescription
void

GlideList2 - toggleList()

Toggles the display of the list and saves the current collapsed/expanded state of the list as a user preference.

Table 55. Parameters
Name Type Description
none
Table 56. Returns
TypeDescription
void

GlideList2 - toggleListNoPref()

Toggles the display of the list but does not save the current collapsed/expanded state of the list as a user preference.

Table 57. Parameters
Name Type Description
none
Table 58. Returns
TypeDescription
void