Publish a Platform Event Using Process Builder 

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

Use Case: 

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. 

Step:1 
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”

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 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

Step:4 

Configure the Process Builder and select The Process starts when A record changes 

Step:5 

Configure the criteria is 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 we get the opportunity Id, Account Id, Amount values from salesforce sent it to the External Application. 

Conclusion: 

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. 

References: 

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.