Calling all TrAIlblazers Learn more
Salesforce became the #1 CRM in the world by becoming the best in handling data. All of its features and benefits revolve around the same word, and the efficiency with which it works is the bedrock for the massive success of this platform.
This CRM gives you the ability to connect various processes and third-party applications via a technique that aids in moving real-time data across them. Known as Platform events, this process is the most coherent way to move & update data.
Platform events exchange information sent through a channel to consumers. Usually, this information is the change that the customers need to know.
Need for Platform Events
One might think about the need for platform events; Why not ask when you need the information update?
The #1 issue with the aforementioned approach is the API call limit. Keeping that into consideration, platform events won’t wait for multiple customer requests for information but will broadcast the changes to all customers.
This eases the process as external platforms do not have to ask constantly but will receive any new information when it's out.
Terminology & Process
Let’s go over a few important terminologies so that you can understand how platform events function.
Event: The change/event that will be communicated to the customers.
Event Bus: The stream where events are added by publishers for the customers. The event bus acts in a queue, executing events strictly in chronological order.
Publishers: Internal or external applications that create the event and push them onto the event bus.
Notification: The notification about the event that has information about the changed data.
Consumer: The customer who the event is for. Consumers can subscribe to specific events; whenever these events are on the event bus, the consumer will be notified.
Salesforce follows an event-driven architecture known as publish/subscribe model, in which the publisher and consumer communicate with each other using events. The latter can subscribe to more than one event and will get notified as soon as the publisher sends an event on the event bus. The event bus can hold multiple events but will carry them out one after the other in chronological order.
How to Create Platform Events?
- Go to Setup in Quick Find and select Platform Events.
- Select New Platform Event.
- Fill in the standard fields with labels, field names and data types.
- You can add custom fields to the platform event.
- Save the Platform Event to create it.
- You can choose from two types of publishing mechanisms
- Publish after Commit: Publishes the event after the transaction is committed.
- Publish Immediately: Publishes the event at the same time the call executes in run time.
Publishing & Subscribing
After the publisher creates a platform event, they have to publish it on the event bus. One can publish an event message with Flows, Processes, Apex and APIs. The consumer will have to subscribe to the event to receive its notification. One can subscribe to a platform event with Flows, Processes, Apex Triggers, Lightning Component, CometD & Workbench.
Platform events have proven to be extremely useful and reliable for real-time exchange of data. We hope you could grasp the concept and understand how you can create one.
Stay updated with everything related to Salesforce with Atocloud, an experienced salesforce development company.