36
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 ...
21
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. ...
20
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 ...
19
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 ...
18
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 ...
17
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 ...
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 ...
14
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 ...
13
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.
13
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, ...
12
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 ...
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.
12
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 ...
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 ...
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 ...
10
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 ...
10
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 ...
10
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 ...
9
votes
How to publish/consume bulkified Platform Events
In V42.0, SFDC added a new REST composite collection resource that is bulkified and works with Platform Events!
/services/data/v42.0/composite/sobjects
{
"allOrNone" : false,
"records" : [{
...
9
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, ...
9
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 ...
9
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 ...
8
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 ...
8
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?" then ...
8
votes
How to monitor Platform Events consumption?
Update from the Winter '20 release notes:
Monitor Platform Event Publishing Usage in REST API
The hourly event publishing usage for standard-volume and high-volume platform events is now ...
8
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 ...
8
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, ...
8
votes
Lightning message service vs platform events vs pubsub
They are different. Let's see how:-
Use Lightning message service to communicate across the DOM between
Visualforce pages, Aura components, and Lightning web components,
including components in a pop-...
8
votes
Accepted
How do I successfully Deploy a Configuration Component for a Platform-Event Trigger to Override the Automated Process User?
The below folder structure and file extensions worked for me
Notice I have prefixed the file with the name .platformEventSubscriberConfig
I used the command below
sfdx force:mdapi:deploy -d ./src --...
7
votes
Accepted
Salesforce Platform Events Pricing
They are free if you have a sufficiently high enough subscription. From the related help topic:
Available in: Performance, Unlimited, Enterprise, and Developer Editions
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
platform-event × 367apex × 102
trigger × 56
streaming-api × 33
lightning-web-components × 28
visual-workflow × 24
integration × 23
cometd × 23
change-data-capture × 20
lightning-aura-components × 19
managed-package × 15
lightning × 14
unit-test × 14
process-builder × 14
asynchronous × 11
batch × 10
callout × 10
rest-api × 9
governorlimits × 9
event × 9
subscriber × 9
limits × 8
visualforce × 7
community × 7
empapi × 7