Platform Event
A Platform Event is a Salesforce messaging mechanism that enables event-driven architecture by allowing systems to publish and subscribe to real-time event messages.
Definition
A Platform Event is a Salesforce messaging mechanism that enables event-driven architecture by allowing systems to publish and subscribe to real-time event messages. Platform Events decouple producers and consumers, enabling communication between Salesforce components, external systems, and asynchronous processes using a publish-subscribe model.
In plain English
“Here's a simple way to think about it: Platform Events are how Salesforce broadcasts change to anything listening. Code or automation publishes; subscribers (Flows, triggers, external systems) receive asynchronously. The decoupling layer for cross-system notifications.”
Worked example
When a high-priority Case is created in Salesforce, an Apex trigger publishes a Platform Event called Order_Alert__e. A Lightning Web Component on the dispatcher's screen subscribes to this event and displays a real-time toast notification. Simultaneously, an external monitoring system also subscribes to the same event via CometD and creates a ticket in their internal tracking tool.
Why Platform Events are how Salesforce broadcasts change to anything listening
A Platform Event is a Salesforce-managed message: code or automation publishes an event with a defined schema, and any subscribers - internal Flows, Apex triggers, external systems - receive it asynchronously. Where standard record changes are observed by triggers, Platform Events are the right mechanism for cross-system notifications, decoupled architectures, and pub/sub integration patterns.
The reason they earn their own concept is decoupling. A trigger that calls another system synchronously creates a tight binding between Salesforce and that system; if the receiver is slow or down, Salesforce slows down or fails. Platform Events break that binding - Salesforce publishes, the platform handles delivery, subscribers consume independently. For event-driven architectures, this is the foundation; build with Platform Events when the receiver shouldn't slow down the publisher.
How to create Platform Event
Platform Events are custom event types you define for pub-sub messaging — Apex / Process / Flow can publish them, and Apex Triggers / external systems can subscribe. They power loosely-coupled integrations between Salesforce features and external systems.
- Open Setup → Platform Events
Setup gear → Quick Find: Platform Events → Platform Events.
- Click New Platform Event
Top-right of the list.
- Set Label and Plural Label
Like a Custom Object. Convention: "<EventName>__e" — the __e suffix is auto-applied.
- Confirm the Object Name
Auto-derived from Label, with __e suffix.
- Pick Publish Behavior
Publish After Commit (event fires after the DB transaction commits — safer) or Publish Immediately (fires as soon as the publish call runs — faster but can fire even if the transaction rolls back).
- Save
Event metadata is created. Now add custom fields for the event payload — the data the event carries to subscribers.
- Add Custom Fields
Custom Fields & Relationships related list → New. Same field types as Custom Objects. Each field is part of the event payload.
- Publish from code
Apex: EventBus.publish(new MyEvent__e(Field1__c='value')). Flow: Create Records on the Platform Event. Process Builder: Create a Record action.
- Subscribe from code
Apex Trigger: trigger MyEventTrigger on MyEvent__e (after insert) { ... }. Or via CometD / Pub-Sub API for external subscribers.
Required.
Required.
Required. Auto-derived; __e suffix appended.
Required. Publish After Commit is the default and usually correct.
- Platform Events are not stored in the database — they're transient. Subscribers receive them in real time; missed events are lost (unless using a high-volume / replay-enabled subscription).
- Publish quotas apply: 100k events/day for Enterprise, more for higher editions. Burst-publishing breaks the quota fast.
- Publish Immediately fires even if the calling transaction rolls back. Subscribers may act on data that was never committed — usually a bug. Default to Publish After Commit unless you have a specific reason.
How organizations use Platform Event
Order-completion Platform Events fire to multiple subscribers; downstream systems consume independently.
Inventory-change events broadcast to e-commerce, ERP, and warehouse systems simultaneously.
Trust & references
Straight from the source - Salesforce's reference material on Platform Event.
- Publishing Platform EventsSalesforce Developers
- Subscribing to Platform EventsSalesforce Developers
Test your knowledge
Q1. Where would a developer typically work with Platform Event?
Q2. What skill set is typically needed to work with Platform Event?
Q3. What is a Governor Limit in the context of Platform Event?
Discussion
Loading discussion…