- 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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @nwilliam,
Are you trying to use a catalog item in the workspace? What's the purpose? Share more details, please.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@sarah_bioni I'm using the catalog item component to utilize a record producer. When I hit submit a BR runs that can throw an addInfoMessage...but it delays it until I refresh the page.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
what if component is record component ? is there any event to handle addinfomesages display on record component ?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I believe as per the recommendation by ServiceNow, we should minimize customization. This should be a standard behavior across platform. Making this much changes just to show an error message (which is already working everywhere except on UI builder pages) is a bit too much.
I have a scenario where the short description & description should not be same while saving incident. I have created a BR which will only work if the session is interactive. The BR works everywhere except on the overview tab of SOW. If we are changing the values in the overview tab the error message is not appearing.