spModal - Client
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API implementation and reference
Shows alerts, prompts, and confirmation dialogs in Service Portal widgets. The spModal class is available in Service Portal client scripts.
The spModal class is a lightweight wrapper for Angular UI bootstrap's $uibModal. You can use the spModal.open() method to display a widget in a modal dialog.
spModal - alert(String message).then(fn)
Displays an alert.
Name | Type | Description |
---|---|---|
message | String | The message to display. |
Type | Description |
---|---|
Boolean | The promise contains a single argument that contains true or false. |
Example
spModal - confirm(String message).then(fn)
Displays a confirmation message.
Name | Type | Description |
---|---|---|
message | String | The message to display. |
Type | Description |
---|---|
Boolean | The promise contains a single argument that contains true or false. |
Example
Example
Confirm with HTML message:
spModal - open(Object options).then(fn)
Opens a modal window using the specified options.
Name | Type | Description |
---|---|---|
options | Object | An object that may have these properties.
|
Type | Description |
---|---|
void |
Example
The following code example shows how to create a prompt with a label.
Example
The following code example shows how to use the custom buttons option.
Example
The following code example shows how to use the embedded widget option.
spModal - prompt(String message, String default).then(fn)
Displays a prompt for user input.
Name | Type | Description |
---|---|---|
message | String | The message to display. |
default (optional) | String | A default value to use if the user does not provide a response. |
Type | Description |
---|---|
String | The promise contains the user's response, or the default value if the user does not enter a response. |