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. We can 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:
Use Case:
Whenever an Opportunity record’s stage field value changes from any of the stages to Closed Won, then we need to send the piece of Information from Salesforce to an external Platform.
Step:1
Create a Platform Event Label Name as Order Event
Set Event Type as” a High Volume”
Set Publish Behavior like “Publish After Commit”
Set Deployment status as “Deployed”.
Step:2
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.
Step:3
In the Platform Event, we are going to create three fields. When the Opportunity stage is changed from any stage to Closed Won. we are sending out the Opportunity Id, Amount, Account Id. These three pieces of Information are sent from Salesforce to External platform.
Step:4
Configure the Process Builder, and select the Process that starts when A record changes
Step:5
Configure the criteria like Opportunity stage has been changed from any of the stages to Closed Won
Step:6
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.
Step:7
Change the stage from Proposal/Price Quote to Closed Won.
Step:8
The Order Event is triggered successfully, and the opportunity Id, Account Id, Amount values from Salesforce are sent to the External Application.
Conclusion:
The Platform Event (Order Event) is triggered successfully from Process Builder to send the data to an external application.
References: