Why addInfoMessage / addErrorMessage Don't Work in Custom Workspaces – and How to Fix It
New article articles in ServiceNow Community
·
May 02, 2025
·
article
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.
- Name:
- 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.
https://www.servicenow.com/community/next-experience-articles/why-addinfomessage-adderrormessage-don-t-work-in-custom/ta-p/3253359