Activity Forums Salesforce® Discussions what is the Use of database.querylocator in Salesforce?

  • Kirandeep

    Member
    January 21, 2020 at 5:25 pm

    Database.getQueryLocator in Salesforce returns a Query Locator that runs your selected SOQL query returning list that can be iterated over in batch apex or used for displaying large sets in VF.

  • Ratnesh

    Member
    January 21, 2020 at 5:36 pm
    • Database.getQueryLocator returns a Query Locator that runs your selected SOQL query returning list that can be iterated over in batch apex.
    • The query locator can return up to 50 million records
    • It should be used in instances where you want to batch a high volume of data up (pagination or batch apex).
    • The database.query method should be used in instances where you are wanting to do a dynamic runtime SOQL query for your code.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos