0

I am running a scheduled batch job daily on 25,000 records and growing. I Want to be able to leverage Salesforce Flow for processing the data because it gives more control to the Admin for manipulating outputs.

I checked the salesforce developer documentation and found the Flow.Interview class.

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/flow_interview_class.htm

In the documentation, they pass a single record into the flow, which from my understanding is not bulkified and would result in me having to launch a loop for each record in the batch. Unfortunately, this is not scalable and will lead to governor limit issues.

So my question is how can we call the Flow.Interview class and ensure that the way we pass in inputs is bulkified?

1 Answer 1

2

First, a relevant question/answer on this topic re: Flow.Interview

I can imagine a couple of options that might work for some applications:

Option 1 - Use a Schedule-triggered Flow instead of the batch job

You'll get a minimum of 250K interviews per day and it will be bulkified

Option 2 -- Use Apex DML with accompanying Flow to do the work

You could have your batch job's execute() update a toggle on the object in question.

When the toggle is true, you have a record-triggered flow do the "work". SFDC will bulkify the scope's flow interviews

At the conclusion of each interview, toggle the field back to its initial state.

1
  • Amazing solution... Thank you! Dec 4, 2021 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .