Salesforce Asynchronous Apex: Batch Apex Job Chaining Limitations
Looking for Salesforce Training & HandsOn Projects?
Trailblazer Profile | LinkedIn | Salesforce Blog | Facebook | Youtube Channel | WhatsApp Community
Salesforce offers
Batch Apex implementation that supports the processing of a humungous volume of
data (millions of records) asynchronously in the form of batches without
violating the platform governance limits.
To know how to start with Batch Class development, you can refer
to the previous articles-
Salesforce
Asynchronous Apex: How to work with Batch Apex Class
Salesforce
Asynchronous Apex: How to chain Batch Apex Jobs
In this article, we will review the know limitations of Batch
Apex Chaining & understand the recommended implementation of the chaining
pattern.
Step-1: To start with let’s review the Accounts Object which is going to be the source of records for this demo
Step-2 & 3: As we did in earlier articles, we will use
Workbench & prepare the SOQL Statement to be used in Batch Apex to provide
actionable records. We will test the SOQL & ensure that it returns the
desired records only
Step-5: After the filter is applied the Opportunity List View would look something like as shown below-
Step-6 & 7: As we did in earlier steps, we will use Workbench & prepare the SOQL Statement to be used in Batch Apex to provide actionable records. We will test the SOQL & ensure that it returns the desired records only
Step-8 to 13: We are creating a Batch Apex class
“UpdateAccounts” as usual. If you need a detailed explanation on this please
refer to the earlier articles on Batch Apex.
The only catch in this Batch class is on Step-12, where we are trying to chain another Batch Apex class inside the “execute” method instead of the “finish” method.
Step-22:
Now we can review the debug logs to analyze the outcomes.
As shown below, Parent Job executes & updates the Account Records successfully. Then Parent Job tries to execute the Child Job from inside the “execute” method & we can see this operation got failed.
Comments
Post a Comment