3. Platform Events ● Platform events are part of Salesforce’s enterprise
messaging platform
● Platform events are the event messages (or
notifications) that your apps send and receive to take
further action
● Publishers and subscribers communicate with each
other through events
4. Event Driven
Software
Architecture
An event-driven (or message-driven) software
architecture consists of event producers, event
consumers, and channels.
Event Producer
Event Producer
Event Producer
E
V
E
N
T
B
U
S
Event Subscriber
Event Subscriber
Event Subscriber
5. Platform Event
Object
● Platform events are sObjects, similar to
custom objects.
● As custom objects we have __e at last of
platform event.
● ReplayId : System Field to identify the
Events uniquely
● Available in: both Salesforce Classic and
Lightning Experience
● Available in: Performance, Unlimited,
Enterprise, and Developer Editions
● User Permissions needed
○ To Create and Edit the Platform
Events
6. Platform Event
Consideration
● Field-Level Security
● Permanent Deletion of Event Definitions
● Renaming Event Objects
● No Associated Tab
● No Record Page Support in Lightning
App Builder
● Platform Events in Package Uninstall
● No Support in Professional and Group
Editions
7. Apex, API, and
SOQL
Considerations
● Only after insert Triggers Are Supported
● Infinite Trigger Loop and Limits
● Apex DML Limits for Publishing Events
● API Request Limits for Publishing Events
● Replaying Past Events
● Filtered Subscriptions
● No SOQL Support
8. Publishing
Platform Events
● Using Apex
○ Use EventBus.publish()
● Using Processes
○ Add a Create a Record action to the appropriate
process
● Using Flows
○ Add a Record Create or a Fast Create element
to the appropriate flow
● Using Salesforce APIs
○ Creating records of your event in the same way
that you insert sObjects
9. Subscribing to
Platform Events
● Subscribe with Apex Trigger
○ Events can receive in trigger regardlessly how
they have been created.
○ Triggers provide an auto subscription
mechanism
○ No need to explicitly create and listen to a
channel in Apex
● Subscribe with CometD
○ For subscribing to External System
○ Syntax : /event/***<EventName>***__e