action - Scoped, Global
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API reference
The action API provides methods to handle data for URLs in a UI action script.
Use this API to configure UI actions with which users can interact. Use these scripts in the UI Action [sys_ui_action] table. For information, see UI actions.
Methods for this API are referred to by the variable name 'action' in any server-side JavaScript. To learn more, see Creating interactions with UI actions.
action - getGlideURI()
Gets a GlideURI object to determine the user view.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Object | GlideURI object representing the URI parameter of the user view. Note: Any other returned value is considered an error, including null. |
Example
The following example shows how to get the user view and set the redirect URL to the service catalog home page.
action - getReturnURL()
Gets the URL of the return page in view after a UI action is complete.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | URL of the return page in view after a UI action is complete. |
Example
action - getURLParameter(String parameterName)
Gets the value of a URL parameter.
Name | Type | Description |
---|---|---|
parameterName | String | Name of the URL parameter name to be queried for the URL parameter value. |
Type | Description |
---|---|
String | URL parameter value. |
Example
action - openGlideRecord(Object gr)
Opens a page with a GlideRecord in the user view.
Name | Type | Description |
---|---|---|
gr | GlideRecord | GlideRecord of the page to be opened in the user view. |
Type | Description |
---|---|
void |
Example
The following example shows how to include the caller name and incident description created from an interaction record. For more details, see Set up custom UI actions in Workspace.
action - setNoPop(Boolean noPop)
Indicates whether to enable or disable pop-up windows on the page in the current view.
Name | Type | Description |
---|---|---|
noPop | Boolean | Flag indicating whether to enable or disable pop-up windows on the page:
|
Type | Description |
---|---|
None |
Example
The following example shows how to disable pop-up windows for a UI action.
action - setRedirectURL(Object URL)
Sets the redirect URI for this transaction, which determines the next page the user sees.
Name | Type | Description |
---|---|---|
URL | Object | URL to set as the redirect. You can provide the URL as a string or a GlideRecord. If you pass the URL as a GlideRecord, this value takes the focus to that record's form. |
Type | Description |
---|---|
void |
Example
The following example shows how to redirect a user to a URL from a UI action using the current variable.
Example
action - setReturnURL(Object URL)
Sets the return URI for this transaction after a UI action is complete. You can use this method to determine what page the user has in view when they return from submit.
Name | Type | Description |
---|---|---|
URL | Object | URI to set as the return location after a UI action is complete. You can provide the URL as a string or a GlideRecord. |
Type | Description |
---|---|
void |
Example
The following example enables the user to select the UI action to create a change record using information from the problem record and the change template. After the change, the user returns to current view. For more information, see Scripted templates. For more use cases, see Task relationships with UI actions.
action - setURLParameter(String parameterName, String parameterValue)
Sets a URL parameter name and value.
Name | Type | Description |
---|---|---|
parameterName | String | Name of the URL parameter. |
parameterValue | String | Value of the parameter. |
Type | Description |
---|---|
void |