Skip to main content
41 votes
Accepted

How do I see debug logs for Platform Event triggers in Salesforce?

From Christopher Marzilli via twitter: when you go into setup to create a new trace you should see an option for "Traced Entity Type" select Automated Process. It appears that Summer '17 ...
Daniel Ballinger's user avatar
26 votes
Accepted

How do I change the running user of a platform event trigger handler?

First, let's lay down some concepts. Platform events can have a variety of subscribers aside from apex triggers. To generically configure the system's behavior for all of these subscriber types, ...
Nathanael Schmolze's user avatar
24 votes
Accepted

Can you query a Platform event?

Other answers have shown that it's not supported to query events using SOQL, but I want to clarify that it's not only not supported, it is not meaningful. Platform events form an ordered time stream. ...
David Reed's user avatar
  • 93.4k
22 votes

What is the difference between the Streaming API PushTopic, Generic Streaming and Platform Events

Very generally, the Streaming API was created primarily to update UI components(Source) where as Platform Events are for integrations via a Message Bus. With a PushTopic from the Streaming API you are ...
Daniel Ballinger's user avatar
21 votes
Accepted

Test that a Platform Event was published?

My colleague suggested the following solution. Events can be stacked in static property and then checked in assert. So trigger can be refactored like following trigger CustomObject on ...
Patlatus's user avatar
  • 17.4k
21 votes
Accepted

Apex Rest Vs Platform Events for Inbound SF integration which one to choose?

UPDATE I have also discussed this topic with some more detail on on my blog here. Based on your requirements where: External System will push data in Salesforce. My recommendation is to ...
Jayant Das's user avatar
  • 30.6k
19 votes
Accepted

Do Platform Event Triggers process synchronously? Do they get a fresh set of limits?

Are the subscription triggers processed synchronously or asynchronously? Aynchronously Do the subscription triggers get separate limits from the publishing context? Yes, separate limits from the ...
Daniel Ballinger's user avatar
16 votes
Accepted

Sandbox Trigger that subscribes to platform event never executes

Turns out that you have to actually go into the sandbox (just refreshed from PROD) and recompile the subscribing trigger for SFDC to recognize it as available to the Platform Event subsystem. In a ...
cropredy's user avatar
  • 72.5k
15 votes

What is the difference between the Streaming API PushTopic, Generic Streaming and Platform Events

Another significant differences - In streaming API's we lose the update (event) if the subscriber is offline, however in platform events they will be available in the event bus for a duration of 24 ...
Salesforcesmarty's user avatar
14 votes
Accepted

Invalid Type when trying to create Platform Event

The Platform Event feature was introduced very recently. Any time you are making use of such a new feature, make sure you set the API Version to the most up to date value available.
Adrian Larson's user avatar
  • 151k
14 votes
Accepted

Testing BatchApexErrorEvent trigger

So as I can see from your code Divide by zero will throw an exception. Which inturn will fire BatchApexErrorEvent . The thing we need to look for is this is the test context. The events will not ...
Pranay Jaiswal's user avatar
13 votes

Can you call a webservice from a Platform Event Trigger?

Older question but felt compelled to add an answer, as I was confused by what was presented here so far. If you are asking "can I make an Apex HTTP Callout from my Apex Platform Event Trigger?&...
Grekker's user avatar
  • 1,092
13 votes
Accepted

What causes platform events to fail to be published and should I cater for failed platform event creations?

What could cause a creation of a platform event to fail? You can actually find this on Platform Event Error Status Codes which lists down the reasons for the failures. And it seems there are ...
Jayant Das's user avatar
  • 30.6k
13 votes
Accepted

How to determine Platform Event Size in Apex to ensure to be within < 1 MB

Maximum size allowed is 1048576 bytes (1.05MB) When you exceed the limit, you will get below message: (Database.Error[getFields=();getMessage=The event payload size of 1179064 bytes exceeds the ...
salesforce-sas's user avatar
12 votes

empApi with Lightning Web Components?

How about option 3: Wait a week. According to the release notes, EmpApi is currently slated to go live in LWC for Summer 19.
pchittum's user avatar
  • 19.8k
11 votes

Queueable Apex not working in Platform Event Trigger

After struggling with this for longer than I'd like to admit, I found a method that enables us to test Platform Event Triggers that enqueue Queueable jobs. The magical method is: Test.getEventBus()....
brettbarlow's user avatar
11 votes
Accepted

Change Data Capture vs Platform Events vs Replication API vs Streaming API vs Batch Data Synchronization

The replication API is designed to have synchronization windows of at least five minutes, so would not be suitable for synchronization of shorter periods. Most ETL tools also don't support windows of ...
sfdcfox's user avatar
  • 500k
11 votes
Accepted

How to clear/delete published Platform event from EventBus after sometime?

This is a feature called Event Durability. It is expected that the client retains the last replayId it has seen, and pass this in to the streaming handshake to resume where they left off. There's no ...
sfdcfox's user avatar
  • 500k
11 votes

Change Data Capture

Change Data Capture : Receive near-real-time changes of Salesforce records, and synchronize corresponding records in an external data store. Change Data Capture publishes data change events, which ...
Hemavantha Rajesh Varma Mudunu's user avatar
11 votes
Accepted

Platform Event - lightning:empApi

Per documentation, lightning:empApi is not supported in Communities. If you refer to the Experience section in the documentation, the only supported experiences are LEX and Mobile. Refer screenshot ...
Jayant Das's user avatar
  • 30.6k
11 votes
Accepted

what is the core benefit of platform events

Platform Events are a type of Enterprise Service Bus. What this means is that multiple systems can be interconnected without any of them needing to know about the others. You can have systems A and B, ...
sfdcfox's user avatar
  • 500k
11 votes
Accepted

Do Apex Transaction have a unique Id (like Batch Ids)?

New, as of Winter 21 you can do this by calling Request.getCurrent().getRequestId() See https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_apex_Runtime_Detection.htm And https://...
Aidan's user avatar
  • 13.9k
11 votes
Accepted

Platform Event Subscription not working for some users!

It is in-fact a permission issue. Since, Platform events are also sObjects. I needed to give read permission to that sObject in the permission set for that profile. for debugging, I added an error ...
Nithesh N's user avatar
  • 475
11 votes
Accepted

Performance gains of moving automation into a trigger?

There are some metrics published officially by the Architect relations team and you can read them on the new architect website. Clearly from the analysis Triggers are efficient when it comes to ...
Mohith Shrivastava's user avatar
11 votes

How do I successfully Deploy a Configuration Component for a Platform-Event Trigger to Override the Automated Process User?

This feature seems extremely finicky. I noticed that the XML metadata API deployment was NOT correctly populating the data (You can verify with the SOQL query below.) I managed to get it working ...
sfdx wolf's user avatar
  • 180
10 votes
Accepted

Can I use platform event (which calls apex method) as alternative to future method?

Generally I wouldn't recommend it as a way of preforming delayed asynchronous processing that would otherwise be handled by future or queueable methods. That's just me thou and your extenuating ...
Daniel Ballinger's user avatar
10 votes
Accepted

How to publish/consume bulkified Platform Events

My original answer, while useful is not the full story. After an extended discussion on the Platform Events Success Community with the Product Manager, it turns out as a trigger (or for that matter, ...
cropredy's user avatar
  • 72.5k
10 votes

Any Platform Event Library or Best Practices out there?

Is it smart to create events like CaseInserted__e for all the possible objects i need to track, or is is smarter to have a general SObjectInserted__e event? Generally, use one event for each unique ...
sfdcfox's user avatar
  • 500k
10 votes
Accepted

Will Change Data Capture eventually replace PushTopics/Streaming API?

There are a lot of considerations behind this and I'm not on the engineering teams that are behind these features so take my answer with a grain of salt. The TL;DR is yes, Change Data Capture (CDC) ...
POZ's user avatar
  • 4,449
9 votes

Publish and/or subscribe to Platform Events between separate Orgs?

Response from Jay Hurst (Salesforce PM): Subscribing and publishing between orgs is not something that is natively supported today. We have discussed it, but it is not on the short term roadmap. You ...
Daniel Ballinger's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible