Action script for list context menus
reference brazil Updated Sep 10, 2026 1 min read r_ActionScript.md
The Action script field, on the Context Menu form, defines a script. The script runs when someone selects the context menu option.
This script is client-side and runs in the user's browser. The following JavaScript variables are available to the Action script when it is executed.
| Variable | Description |
|---|---|
| g_list | GlideList2 against which the script runs. |
| g_fieldName | Name of the field against which the context menu runs. |
| g_fieldLabel | Label of the field against which the context menu runs. |
| g_sysId | The sys_id of the row or form against which the script runs. |
The base system uses the following code in an action script to refresh the platform view.
JavaScript
g_list.refresh(1);Another example is the use of these variables in a list header menu to sort a list by the selected field in descending order (z to a).
JavaScript
g_list.sortDescending(g_fieldName);40 lines · 1.5 KB
--- title: Action script for list context menus description: The Action script field, on the Context Menu form, defines a script. The script runs when someone selects the context menu option. locale: en-US canonical_url: https://www.servicenow.com/docs/r/platform-administration/list-administration/r\_ActionScript.html release: brazil product: List Administration classification: list-administration topic_type: reference last_updated: "2026-09-10" reading_time_minutes: 1 breadcrumb: [List context menus, Administer, List administration, Forms, fields, and lists, Configure core features, Administer the ServiceNow AI Platform] --- # Action script for list context menus The **Action script** field, on the Context Menu form, defines a script. The script runs when someone selects the context menu option. This script is client-side and runs in the user's browser. The following JavaScript variables are available to the Action script when it is executed. |Variable|Description| |--------|-----------| |g\_list|GlideList2 against which the script runs.| |g\_fieldName|Name of the field against which the context menu runs.| |g\_fieldLabel|Label of the field against which the context menu runs.| |g\_sysId|The sys\_id of the row or form against which the script runs.| The base system uses the following code in an action script to refresh the platform view. ``` g_list.refresh(1); ``` Another example is the use of these variables in a list header menu to sort a list by the selected field in descending order \(z to a\). ``` g_list.sortDescending(g_fieldName); ```
| title | Action script for list context menus |
| description | The Action script field, on the Context Menu form, defines a script. The script runs when someone selects the context menu option. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/platform-administration/list-administration/r\_ActionScript.html |
| release | brazil |
| product | List Administration |
| classification | list-administration |
| topic_type | reference |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | List context menusAdministerList administrationFormsfieldsand listsConfigure core featuresAdminister the ServiceNow AI Platform |