Process Builder – Salesforce Configuration:
Platform events are part of Salesforce’s enterprise messaging platform. The platform supplies an event-driven messaging architecture to enable apps to communicate inside and outside Salesforce. A platform event has been defined in our Salesforce org, publish event messages from a Salesforce app using processes, flows, Apex, or an external app using Salesforce APIs. Publishers and Subscribers communicate with each other through events. More subscribers can listen to the same event and carry out actions.
Steps to Implement the Platform Event Using Process Builder:
Whenever an Opportunity record’s stage field values are changed from any of the stages to Closed Won. Then we need to send the piece of Information from salesforce to External Platform.
Create a Platform Event Label Name as like Order Event
Set Event Type as” a High Volume”
Set Publish Behavior like “Publish After Commit”
Set Deployment status as “Deployed”.
Platform events can be created like custom objects. The key difference between these two interfaces is there are no Record Types, Page layouts. The API Name of the Platform events ends with __e and “e” stands for Events.
In the Platform Event we are going to create 3 fields. When the Opportunity stage is changed from any of the stages to Closed Won. we are sending out the Opportunity Id, Amount, Account Id. These 3 pieces of Information send it from salesforce to External platform.
Configure the Process Builder and select The Process starts when A record changes
Configure the criteria is like Opportunity stage has been changed from any of the stages to Closed Won
Select the Immediate action as “Create Record” and call the Platform Event like “Order Event” in the Record Type section and map the OpportunityId, Amount, AccountId from the Opportunity.
Change the stage from Proposal/Price Quote to Closed Won.
The Order Event is triggered successfully, and we get the opportunity Id, Account Id, Amount values from salesforce sent it to the External Application.
The Platform Event (Order Event) is triggered successfully from Process Builder and it sent back to the External Application. The Whole Process of triggering the Platform Event is nothing but, trying to create a new record in the Platform Event that we have created it means, that a Platform message has been generated and it’s going to make sure that the information is just streamed to the External Application.