Batch Processing in Salesforce

By | November 4, 2016

Salesforce does not allow to perform DML operation more than 10K records in single transaction. Consider a situation where you have more than 10K records to perform DML operation. Due to Governing limitations of Salesforce (because of Multi-tenant architecture of Salesforce) you won’t be able to do the same. But Salesforce provided very nice feature of Batch Apex processing where you can process thousands of records.

Please follow following steps to implement Batch Apex
-> Create global apex class which extends Database.Batchable Interface because of which the Salesforce compiler will know, this class incorporates batch jobs
global class ClassName implements (Database.QueryLocator | Iterable)

Batch Apex

Batch Apex

-> It contains three method:-

  • Start Method:
    Here you can write SOQL query to retrieve the records on which you want to perform the action. This method returns either Database.QueryLocator or Iterable that contains the records or sObjects.
  • Execute method
    global void execute(Database.BatchableContext BC, list <P>){}
    This method is used to collect the records coming from start method. You can use these records for further processing.
  • Finish method
    global void finish(Database.BatchableContext BC){}
    This method is called after completion of batch. So you can use this method for notification of completion of batch. When apex batch is executed then initializes and scheduled AsyncApexJob based on the batch.

Also, the next blog will cover the various aspects of “how to schedule the batch using Apex scheduler and View Schedule batches”.

For more detail you can use below guide: Check Now

About Us
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information, please contact us at salesforce@greytrix.com. We will be glad to assist you.

Related Posts