Platform Events Apex Job runs before update transaction is complete
Trailblazer Community

Platform Events Apex Job runs before update transaction is complete

Marketing Cloud Integrations , Marketing Cloud Journey Builder

Last updated 2020-01-27 ·Reference W-4847837 ·Reported By 48 users

Fixed in version Marketing Cloud Release January 2020

Summary
Platform Events Apex Jobs run before update transactions are complete, causing records to come into the journey data extension with incorrect (pre-update) values. This is because the apex job created by the platform events is running before the transaction that triggered it is completed and the updates are officially committed.

Repro
1. Make sure Platform Events are turned on for your integrated org
2. Create a journey in the MC on any object with any criteria, triggered on update
3. Create 1,00 records in Salesforce
4. Update those records in Salesforce using a batch update class with batch size of 200

Check the data extension and you'll see the values that were brought in are the pre-update values.

Workaround
You can either:
1. Reduce the batch size for the update to 1; anything 200 and up does not work. It's possible that batch sizes greater than 1 will work but test in your org.
2. Reduce the the processing time by removing validations or custom processes
3. Turn JB Platform Events off. Do not use a batch apex class to do the updates.

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.