Member-only story
How To Publish Platform Events
Publish Salesforce Platform Events with different technologies

Salesforce Platform Events can be created in different ways using
- Flows
- Process Builder
- Apex
- Salesforce APIs
We will take a look at all the variants in this story, let’s kick start right away.
Define a Platform Event
Before we can publish any Platform Event, we need to define one. Let’s create a Platform Event opportunityCreated
. Navigate to Setup > Integrations > Platform Events
and select New Platform Event
. Fill in the below details and save.

Navigate to the Platform Event and create the following Custom Fields.
- we will fill the fields opportunityAmount, opportunityName and opportunityStage from the Opportunity when publishing the Platform Event
- eventType will contain the Event Name and originatedFrom will be filled from the trigger technology and contain either Flow, Process Builder, Apex or API

Alright, our Platform Event structure is ready.
Subscribe to the Platform Event
Next, let’s subscribe to the Platform Event to verify that the publishing (which we do in the next step) works fine. Navigate to Setup > Object Manager
and create a new Custom Object Event Log (API Name: EventLog__c)
with following custom fields.

Navigate to Setup > Process Automation > Flows
select New Flow
and then Platform Event-Triggerd Flow
. Use the Freeform to create the new Flow.