1

I'm trying to run a Visual Flow in Salesforce that runs through all of a custom objects records called Cross Sells (~1,000,000 records) and updates a lookup field. This flow is failing due to the query being great than 50k records.

I have looked online but have been unable to come up with a clear answer. Some forums have advised using the 'Wait' element, others have advised that the Visual Flow can bulkify requests. My current Flow is using a Fast Lookup to create a list of the all the Cross Sell records, and then passing it through a Loop element.

Any advice on how I may be able to structure this visual flow to manage a large dataset would be much appreciated.

  • 1
    Are you able to switch to using Batch Apex to loop over the ~1M records? – Richard Durrant Apr 18 '16 at 9:28
  • I agree with @RichardDurrant this is a job for Batch Apex. I can't see any way that Flow could handle this. – dBeltowski Apr 18 '16 at 19:36
2

Unless you have a way of splitting your flow into segments such that it only returns a portion of your records for each segment that totals less than 50k records at a time, you're going to want to convert that process into a batch or even a queueable process.

A batch job can handle a nearly unlimited number of records using a query locator. It won't have the 50k record restriction on it because of using the query locator, which allows it to only return as many records as your batch process needs to begin processing records in batches of up to 2000 at a time (default is 200 records).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.