In a flow I have a Get element that returns more than 50 000 records, which triggers the error "Element Too many query rows: 50001".

enter image description here

I read all the solutions I could find, but can someone recommend one without APEX action building a query? I am looking for a "native" solution. Please keep in mind the error is in the get element so using the new sort element after it is not an option.

Have a good day

3 Answers 3


Looking at the details of your Flow, it seems you'd like to - on a scheduled basis - delete old leads that have no payments associated with them, and at the moment, you have 50,000+ leads that fit your criteria.

First- I'd suggest associating the Scheduled Triggered Flow with the Lead Object, rather than have it object-agnostic with a Get. When you do this, you build your Flow as if you are evaluating/processing each Lead individually, and then Salesforce handles bulkification for you.

Second, you should then define your Entry Criteria to limit the number of Leads processed. isConverted = false and SumOfPayments__c = 0 should be straightforward to add to Entry Criteria. However, you can't directly define relative date evaluation in Entry Criteria (as of Spring 22). To evaluate the dates, you can take one of two options:

  • Add custom formula fields on the Lead object to evaluate the relative date logic, then add Entry Criteria on the custom formula fields
  • Leave the relative date evaluation out of the Entry Criteria, and use a decision node in the Flow to evaluate whether the Lead is old/inactive

If you use the first option, your Flow can then consist of just single Delete node (I'd recommend supplementing this with some fault handling, but that is all you'd need

If you use the second option, then will consist of a Decision node, with a Delete element in the appropriate Outcome path.

Keep in mind that this approach will mean a FlowInterview will be generated for each Lead that passes the Entry Criteria, and there is a 250,000 per day FlowInterview limit (or 200 * number of users, whichever is larger).


You need to Choose Object in the Start Element as opposed to leveraging a Get Records element as your first element.

enter image description here

Schedule Triggers for Flows That Run for Batches of Records

To have the scheduled flow run for a batch of records, specify the object and the filter conditions that each record must meet.

Even with that ability, you'll want to be aware of the limits in Schedule-Triggered Flow Considerations

The maximum number of schedule-triggered flow interviews per 24 hours is 250,000, or the number of user licenses in your org multiplied by 200, whichever is greater. One interview is created for each record retrieved by the schedule-triggered flow’s query. If you specify an object so that the flow runs for a batch of records, then set the time, frequency, and record conditions to avoid reaching this limit. You can use debug logs to check how many records a schedule-triggered flow runs on. Track the number of records with the FLOW_START_SCHEDULED_RECORDS event. If your org reaches the limit, Salesforce sends a flow error email.

  • 1
    we should merge our answers 😁
    – Jeff Kranz
    Commented Mar 21, 2022 at 13:44

DML Element in Flows (such as GET Record) have a 50,000 record limit, hence the error.

Please select 'Choose Object' in the Start Element to run the flow as a Batch. The maximum number of schedule-triggered flow interviews per 24 hours is 250,000, or the number of user licenses in your org multiplied by 200, whichever is greater.

Please see Scheduled Trigger Flow Considerations

You must log in to answer this question.

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