Activity Forums Salesforce® Discussions Difference between Database.QueryLocator() and Iterable in BatchApex?

  • Manpreet

    Member
    April 4, 2017 at 6:57 am

    Hi Suraj,

    "Difference between Database.QueryLocator() and Iterable in BatchApex?" - The answer depends on your need, if you want to run a batch on records that can be filtered by SOQL then QueryLocator is preferable, but if records that you want to be processed by batch cannot be filtered by SOQL then you will have to use Iterable. But most of the cases it will be achieved by query locator, so query locator is preferable so just try with it if you scope is complex and can not be achieved by SOQL then go with Iterable.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos