Batch Class to Update Record’s Field -- w3web.net

Using batch class to update record’s field and send email notification in finish method on custom Object in Salesforce | batch class to update records on custom object in salesforce

468 views

Hey guys, today in this post we are going to learn about how to write batch class to update records/fields and send email notification in finish method on custom Object in Salesforce

Real time scenarios:- Write a batch class on Custom Object(scoreCard__c) to update Record’s Field through Anonymous Window in Salesforce.

Files we used in this post example

batch_scoreCardEmailUpdate.apxc Apex Class Controller It is used for update Record’s Field through Anonymous Window in Salesforce

Live Demo

batch class to update a field on custom object in salesforce -- w3web.net

Other related post that would you like to learn in lightning component.

Create Apex Class Controller

Step 1:- Create Apex Class : batch_scoreCardEmailUpdate

From Developer Console >> File >> New >> Apex Class

batch_scoreCardEmailUpdate [Apex Class Controller]

Create a instance of batch class and execute Anonymous Window in Salesforce

Step 2:- Open Apex Class >> batch_scoreCardEmailUpdate >> Debug >> execute batch class in Anonymous Window in salesforce

From Developer Console >> Debug >> execute Anonymous Window

For Anonymous Window

batch class to update a field on custom object in salesforce -- w3web.net

Further post that would you like to learn in lightning component.

 

 


 

FAQ (Frequently Asked Questions)

How many records we can process using batch apex?

A maximum of 50 million records can be returned in the QueryLocator object. If more than 50 million records are returned, the batch job is immediately terminated and marked as Failed.

How does batch Apex work?

Each time you invoke a batch class, the job is placed on the Apex job queue and is executed as a discrete transaction. This functionality has two awesome advantages: Every transaction starts with a new set of governor limits, making it easier to ensure that your code stays within the governor execution limits.

How do I test a batch Apex class?

When testing your batch Apex, you can test only one execution of the execute method. You can use the scope parameter of the executeBatch method to limit the number of records passed into the execute method to ensure that you aren't running into governor limits. The executeBatch method starts an asynchronous process.

Related Topics | You May Also Like

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

3 thoughts on “Using batch class to update record’s field and send email notification in finish method on custom Object in Salesforce | batch class to update records on custom object in salesforce”

Leave a Comment