- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 05-02-2025 08:49 AM
Standard server-side messages like addInfoMessage
or addErrorMessage
do not automatically appear in custom Workspaces. This article provides a simple fix using UI Builder to manually map the notification behavior.
Problem:
When working with custom ServiceNow Workspaces, the traditional server-side messaging methods like addInfoMessage()
or addErrorMessage()
do not display messages to users as they do in the classic UI.
Root Cause:
Custom pages built with UI Builder do not automatically include logic to render these notifications. Instead, notifications must be explicitly handled through the component event mappings.
Solution (Step-by-Step):
-
Open UI Builder
Navigate to the UI Builder and select the page where you want the notification to appear. -
Select the Trigger Component
Identify the component responsible for triggering the message (e.g., a list or a button). In my use case, it was a button inside a List component. -
Go to the "Events" Tab
With the component selected, open the Events tab on the right-hand panel. -
Add an Event Mapping
Click on "Add event mapping".-
Name:
Notification(s) displayed
-
Action:
Add alert notifications
-
Items parameter:
{{event.payload.notifications}}
This tells the component to listen for notification payloads and render them as alert banners.
-
-
Test the Notification
After this configuration, when your server script (e.g., in a UI Action or Script Include) callsaddInfoMessage()
oraddErrorMessage()
, the messages will be properly passed through and rendered by the UI component.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for your explanation, can you please explain more about how to put "{{event.payload.notifications}}" into the Action, it seems to me that there is a JSON data to be filled, but {{event.payload.notifications}} is not accepted in this.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Community Alums , I found it under the Events Payloads Queue — it's automatically loaded. Please see the image below.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
is this possible with a catalog item component? At least after reading this I believe that is my issue.