How to publish Salesforce Platform Events. Picture by Buffik from Pixabay.
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.
Press enter or click to view image in full size
Create a new Platform Event in Salesforce.
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