
From your Setup, in quick find box search for “Platform Events” then click on “New Platform Event” then just like your Custom Object enter the label and API name for your Platform Event. Once completed then add any Custom Fields you want.
Table of Contents
What are the different platforms in Salesforce?
With that, here are the tools you can use to build apps on Lightning Platform:
- Salesforce Environments. A secure and isolated development environment for developers and admins to test ideas, accelerate app development, and customize the platform. …
- Heroku. It lets you extend Salesforce by building engaging experiences through custom apps. …
- mySalesforce. …
- myEinstein. …
- Salesforce App Cloud. …
How to subscribe to Salesforce platform event?
Subscribe Channel Listener. Step 1: Add Salesforce Subscribe channel listener and configure as shown below: Step 2: Log the actual platform event which will be in the Object format like below: The sample event would look like: Step 3: Now add Transform message to extract the event message that is encapsulated in the above Object.
How to create your first app in Salesforce?
- To create application in lightning, Click File | New | Lightning Application.
- Enter the name, and click Ok. E.g. appName.app resource. You may set name accordingly.
- Now use c:helloWorld to refer the component helloWorld.cmp using the default namespace c. If your organization has a registered namespace, you can use it to reference. …
What is a platform event?
Platform events are the event messages that your apps send and receive. They simplify the process of communicating changes and responding to them without requiring you to write complex logic. Publishers and subscribers communicate with each other through platform events. One or more subscribers can listen to the same event and carry out actions.

How do I view platform events in Salesforce?
View Event Subscribers From Setup, enter Platform Events in the Quick Find box, then select Platform Events. Click your event’s name. On the event’s definition page, the Subscriptions related list shows all the active triggers, processes, and platform event–triggered flows that are subscribed to the platform event.
How do I use platform events in Salesforce?
We can publish the platform events in 3 ways:Publish Events Messaging using APEX.Publish Events Messaging using Declarative tools (Process Builder or Cloud Flow Designer Tool / Visual Work flow).Publish Events Messaging using Salesforce API from external app.
Can we query platform events?
For platform events, you can query usage data for these metrics. The first value is the metric name value that you supply in the query. For change data capture events, you can query usage data for these metrics. The first value is the metric name value that you supply in the query.
What is Salesforce platform event?
Salesforce publishes standard platform events in response to an action that occurred in the org or to report errors.
When platform events are published?
Platform events are scalable and secure messages holding data. The publishers publish the event messages that the subscribers receive in real-time. If one wants to modify the data publishes, he needs to define platform event fields.
How do I add a platform event record in Salesforce?
Setting up the Platform Event We need to create a custom platform event within Salesforce and add fields to that event. You will recognize this process as it mimics many of the steps in creating a custom object, custom metadata, or custom setting. In Quick Find in the Setup menu, enter “Platform Events.”
How do I trigger a platform event in Salesforce?
To create a platform event trigger, use the Developer Console.Click the Setup icon, select Developer Console, and click File | New | Apex Trigger.Provide a name and choose your event for the sObject, and click Submit.
What is event monitoring Salesforce?
Event Monitoring is one of many tools that Salesforce provides to help keep your data secure. It lets you see the granular details of user activity in your organization. We refer to these user activities as events.
What are the limitations of platform events in Salesforce?
Platform Event LimitsDescriptionPerformance and Unlimited EditionsAll other editionsMaximum number of events published per hour (Events can be published using Apex or APIs.)100,0001,000Maximum number of events delivered to CometD clients within a 24–hour period250,00010,0001 more row
How do I debug a platform event in Salesforce?
To collect logs for an event subscription, add a trace flag entry for the Automated Process entity in Setup.From Setup, enter Debug Logs in the Quick Find box, then click Debug Logs.Click New.For Traced Entity Type, select Automated Process.Select the time period to collect logs and the debug level.Click Save.
What are platform events in LWC?
Platform events enable the flow of event messages within Salesforce and to or from external apps. Apps on the Salesforce platform use an Apex method to publish events and an Apex trigger or the empApi Lightning component to consume events.
Can we deploy platform events in Salesforce?
If your app is on the Salesforce platform, you can publish events using an Apex method or with declarative tools, such as Process Builder or Flow Builder. If your app is an external app, you can publish events using Salesforce APIs.
REST API
To publish a platform event message using REST API, send a POST request to the following endpoint.
Example
If you’ve defined a platform event named Low Ink, publish event notifications by inserting Low_Ink__e data. This example creates one event of type Low_Ink__e in REST API.
REST API Composite Resource
To publish multiple platform event messages in one REST API request, use the composite resource. Send a POST request to the following endpoint.
Example
This composite request contains two platform events in the request body.
SOAP API
To publish a platform event message using SOAP API, use the create () call.
Example
This example shows the SOAP message (using Partner API) of a request to create three platform event messages in one call. Each event has one custom field named Printer_Model__c.
Special Access Rules
Accessing this object requires either the Salesforce Shield or Salesforce Event Monitoring add-on subscription and the View Real-Time Event Monitoring Data user permission.
Working with AdditionalInfo
AdditionalInfo enables you to extend the login event with custom data that can be queried later. For example, you can capture a correlation ID when a user logs in from an external system that shares that unique ID. This process enables tracking logins across systems.
How to Pass Additional Information by Using HTTP with cURL
Here’s an example of passing additional information via the command line.
Standard SOQL Usage
Currently, the only supported SOQL function on LoginEvent is WHERE, and you can only use comparison operators (=, <, >, <=, and >=) on the final expression in a WHERE clause. The != operator isn’t supported.
Async SOQL Usage
With Async SOQL, you can filter on any field in LoginEvent and use any comparison operator in your query.

Types of Platform Events
Defining Platform Events
-
Below are the steps to create a custom Platform Event in Salesforce: 1. 1. In Setup, select Platform Eventsin the quick find. 2. 2. Click New Platform Event. 3. 3. Fill in the standard fields. 4. 4. Platform Events provide two types of publishing mechanisms. Publish after commit is used to publish the event only after the transaction is successfull…
Publishing Platform Events
-
Below are several ways to publish a platform event after defining the same: 1. Publish Event Messages with Flows 2. Publish Event Messages with Processes 3. Publish Event Messages with Apex 4. Publish Event Messages via APIs Below is the code snippet to publish platform event with Apex:
Subscribing Platform Events
-
Below are the several ways to receive the platform event: 1. Subscribe to Platform Event Messages with Flows 2. Subscribe to Platform Event Messages with Processes 3. Subscribe to Platform Event Notifications with Apex Triggers 4. Subscribe to Platform Event Notifications in a Lightning Component 5. Subscribe to Platform Event Notifications with CometD(Workbench)
Conclusion
-
We hope you find this post helpful and will guide you to define, publish, and subscribe to platform events. To know more, don’t hesitate to connect with us. Emizentech, a Salesforce development company, is always there to serve you the best.