PubSubEvents is a client-side utility for enabling highly decoupled communication between blocks and screens in OutSystems applications. It implements the Publish/Subscribe (Pub/Sub) pattern to streamline UI state synchronization, eliminating the need for complex event bubbling or reliance on OnParametersChanged.
OnParametersChanged
This component is designed to help developers build modular, maintainable, and responsive user interfaces by allowing blocks to react to events without direct dependencies.
EventSubscriber Block A lightweight block that listens for a specific event channel (EventId). When an event is received, it automatically triggers a built-in OutSystems event called NotifySubscriber, which bubbles up to the parent block or screen. No manual subscription or unsubscription is required—lifecycle management is handled internally.
EventId
NotifySubscriber
PublishEvent Client Action Broadcasts a message to all subscribers of a given channel. Accepts an EventId and an optional Payload, allowing for targeted, cross-component communication.
Payload
Subscribing to Events
Drag the EventSubscriber block into your UI.
EventSubscriber
Set the EventId input to the name of the channel you want to listen to.
Handle the NotifySubscriber event in the parent block or screen to respond to published messages.
Publishing Events
Use the PublishEvent client action to send a message to a specific channel.
PublishEvent
Provide the same EventId used by subscribers and a lightweight Payload (e.g., a record ID or status flag).
All communication occurs on the client side and is accessible to the end user. Do not transmit sensitive or secure data through the event bus. Any Server Actions triggered by a published event must revalidate user roles and permissions to ensure proper access control.
New EventSubscriber Block Introduced a reusable block that simplifies event subscription. Just drop it into your UI and configure the EventId and OnEvent—no need to manually call SubscribeToEvent.
OnEvent
SubscribeToEvent
Automatic Unsubscription The EventSubscriber block now handles cleanup automatically via OnDestroy, preventing memory leaks and reducing boilerplate code.
OnDestroy
Improved Documentation & Developer Experience Updated descriptions, usage examples, and Forge listing to reflect the new block-based architecture. Easier onboarding for new developers.
Refactored internal logic for better performance and maintainability.
Improved naming conventions and input validation for EventId and Payload.
Added comments and structure to client actions for easier customization.
If you previously used only the SubscribeToEvent client action, consider migrating to the new EventSubscriber block for better lifecycle management.
Deprecated manual unsubscription patterns—these are now handled automatically.
Events are transmitted entirely on the client side. Do not send sensitive data through the Payload. Always validate permissions and roles server-side before executing any critical logic.