Possible to use Process Builder subscribed to Platform Event to create New Record?

I know it’s possible to create a Process Builder that executes based on receiving a Platform Event but is it possible to use the Process Builder to simply create a new Record every time an event is received?


It seems as though I need to specify Matching Criteria for an existing record which is not something I want to do.

I simply want to map fields from the Platform Event to fields on a new custom object Record every time the event is received.

If I receive 50 events, I want to create 50 new records in my custom object.

(I know this can be done via Apex triggers I’m simply trying to avoid doing so for this use case)


From docs:

If the process starts when a platform event message is received,
associate the process with a platform event and an object, and specify
matching conditions. Because every process acts on a Salesforce
record, it requires a single record as a starting point. That way, the
criteria and actions know where to start evaluating and executing.The process fails if it finds:

1) Multiple records that match the criteria.

2) No records that match the criteria.

This bit is bit funny from SF end, But you can bypass it, but providing a dummy record.

Create a dummy Object, with an external field `D_External__c’. Then create a single record of that dummy Object. And set Value of External Field as constant. eg 78234564654

Now add an extra field in your event
My_External_Dummy_Field__C , and default its value as 78234564654 . The one you defined in the record you created.

enter image description here

This will make sure, each event fired will have My_External_Dummy_Field__C as 78234564654

In your Process Builder, Match your Dummy_Object’s external field with My_External_Dummy_Field__C

enter image description here

As this matching condition will always match because of single record of dummy object and setting the default value of the platform event, your process builder will always run. And you can create do whatever you want.

Source : Link , Question Author : Jamie G , Answer Author : Pranay Jaiswal

Leave a Comment