--- title: g\_modal \(Next Experience\) - Client description: The g\_modal API enables you to display a modal window to enhance application functionality.Displays an alert message relating to a UI action.Displays a confirm message relating to a UI action.Displays a confirm message related to a UI action, with the confirm button displaying a destructive style.Displays a modal that uses passed HTML to generate the content within the modal.Displays a modal window that contains the specified fields and an OK and Cancel buttons by default.Displays a modal that uses a link to an external URL or UI page for its content. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/g\_modalClientAPINX.html release: australia product: API Reference classification: api-reference topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 18 breadcrumb: [Client Next Experience API reference, API reference, API implementation and reference] --- # g\_modal \(Next Experience\)- Client The g\_modal API enables you to display a modal window to enhance application functionality. Use this API to display modals in workspaces. Using this API you can: - Display input type fields in a modal window. - Show something in a frame such as a UI page or external link. - Perform an action on user confirmation. - Load a component. - Use HTML to populate the contents of a modal. **Parent Topic:**[Client Next Experience API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/api-client-next.md) ## g\_modal \(Next Experience\) - alert\(String title, String message, Function callback, style Object\) Displays an alert message relating to a UI action.
| Name | Type | Description |
|---|---|---|
| title | String | Optional. Title to display in the header of the modal.Default: Alert |
| message | String | Message to display in the modal body. **Note:** If you only pass one parameter, the method treats it as the **message** parameter. |
| callback | Function | Optional. Function to call after the form has been submitted and processed on the server. The callback function has the form `callbackFunction(String action_verb, String sys_id, String table, String displayValue)` where: - **action\_verb**: Name of the UI action executed. Examples: - sysverb\_cancel \(Cancel button\) - sysverb\_insert \(Submit button\) - sysverb\_save \(Save button\) - **sys\_id**: Sys\_id of the affected record. - **table**: Name of the table containing the record. - **displayValue**: Value that appears on the form. Default: No additional processing |
| style | Object | Optional. Style of the confirmation button to display in the modal.``` "style": { "buttonTitle": "String", "buttonType": "String" } ``` |
| style.buttonTitle | String | Optional. Text to display on the confirmation button.Default: OK |
| style.buttonType | String | Optional. Type of confirmation button to display.Default: default |
| Type | Description |
|---|---|
| Promise | If a **callback** parameter is passed, returns promise if successful, error otherwise.If a **callback** parameter isn't passed, the method always returns success. |
| Name | Type | Description |
|---|---|---|
| title | String | Optional. Title to display in the header of the modal.Default: Confirm |
| message | String | Message to display in the modal body. **Note:** If you only pass one parameter, the method treats it as the **message** parameter. |
| callback | Function | Optional. Function to call after the form has been submitted and processed on the server. The callback function has the form `callbackFunction(String action_verb, String sys_id, String table, String displayValue)` where: - **action\_verb**: Name of the UI action executed. Examples: - sysverb\_cancel \(Cancel button\) - sysverb\_insert \(Submit button\) - sysverb\_save \(Save button\) - **sys\_id**: Sys\_id of the affected record. - **table**: Name of the table containing the record. - **displayValue**: Value that appears on the form. Default: No additional processing |
| style | Object | Optional. Style of the confirm and cancel buttons to display in the modal.``` "style": { "cancelTitle": "String", "cancelType": "String", "confirmTitle": "String", "confirmType": "String" } ``` |
| style.cancelTitle | String | Optional. Text to display on the cancel button.Default: Cancel |
| style.cancelType | String | Optional. Type of cancel button to display.Valid values: - confirm \(blue background\) - default \(white background\) - destructive \(red background\) Default: confirm |
| style.confirmTitle | String | Optional. Text to display on the confirm button.Default: OK |
| style.confirmType | String | Optional. Type of confirm button to display.Valid values: - confirm \(blue background\) - default \(white background\) - destructive \(red background\) Default: default |
| Type | Description |
|---|---|
| Promise | If a **callback** parameter is passed, returns promise if successful, error otherwise.If a **callback** parameter isn't passed, the method always returns success. |
| Name | Type | Description |
|---|---|---|
| title | String | Optional. Title to display in the header of the modal.Default: Confirm |
| message | String | Message to display in the modal body. **Note:** If you only pass one parameter, the method treats it as the **message** parameter. |
| callback | Function | Optional. Function to call after the form has been submitted and processed on the server. The callback function has the form `callbackFunction(String action_verb, String sys_id, String table, String displayValue)` where: - **action\_verb**: Name of the UI action executed. Examples: - sysverb\_cancel \(Cancel button\) - sysverb\_insert \(Submit button\) - sysverb\_save \(Save button\) - **sys\_id**: Sys\_id of the affected record. - **table**: Name of the table containing the record. - **displayValue**: Value that appears on the form. Default: No additional processing |
| style | Object | Optional. Style of the confirm and cancel buttons to display in the modal.``` "style": { "cancelTitle": "String", "cancelType": "String", "confirmTitle": "String", "confirmType": "String" } ``` |
| style.cancelTitle | String | Optional. Text to display on the cancel button.Default: Cancel |
| style.cancelType | String | Optional. Type of cancel button to display.Valid values: - confirm \(blue background\) - default \(white background\) - destructive \(red background\) Default: confirm |
| style.confirmTitle | String | Optional. Text to display on the confirm button.Default: OK |
| style.confirmType | String | Optional. Type of confirm button to display.Default: destructive |
| Type | Description |
|---|---|
| Promise | If a **callback** parameter is passed, returns promise if successful, error otherwise.If a **callback** parameter isn't passed, the method always returns success. |
| Name | Type | Description |
|---|---|---|
| title | String | Optional. Title to display in the header of the modal.Default: blank |
| richText | String | HTML content to display in the modal.**Note:** This method removes ` |