I want to add the info messages in the workspace for the button created in the UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
I want to add info messages in the workspace for a button that I've created using a UI Action.
Context:
- Instance: Next Experience / Workspace (UI Builder)
- I have a UI Action that creates a custom button on a workspace record page
- When the button is clicked, I want to show an info/success message to the user (similar to g_form.addInfoMessage() in classic UI)
What I've tried:
- [List what you've already attempted — e.g., calling g_form.addInfoMessage() directly in the UI Action client script, but it doesn't render in the Workspace UI]
- [Any GlideDialogWindow, Toast, or Now Experience UI notification APIs you've explored]
What I expect:
- Clicking the button should trigger a visible toast/info message to the user in the Workspace, confirming the action succeeded (or showing validation errors)
Has anyone successfully surfaced info/error messages from a UI Action button inside a Workspace (UI Builder) context? Is there a specific API (like sn_workspace or a UI Builder event) I should be using instead of the classic g_form messaging methods?
Any pointers or code snippets would be appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @JallipalliK
g_form.addInfoMessage() is designed for the classic UI, so it won't reliably display messages in Workspace.
If you're using a Workspace UI Action, one approach is to return the result from the server and display a Workspace notification from the client. For example:
// Client-side g_form.submit('your_ui_action_name'); // After the action completes g_form.addFormMessage('Action completed successfully.', 'info');
If addFormMessage() isn't available in your Workspace version, the recommended approach is to use a UI Builder Notification (Toast). Create a Notification/Toast component in UI Builder, dispatch an event after your action completes, and configure the notification to display the success or error message.
If your UI Action is server-side, you can also use:
gs.addInfoMessage('Action completed successfully.');
action.setRedirectURL(current);
This works when the record reloads after the action, although the behavior can vary depending on the Workspace version.
If none of these options work, please let us know:
- Which ServiceNow release are you on (Washington, Xanadu, Yokohama, etc.)?
- Are you using Agent Workspace or Configurable Workspace?
- Is your button a traditional UI Action or a Declarative Action?