From the course: Introduction to Test Classes in Salesforce
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Batch Apex - Salesforce Tutorial
From the course: Introduction to Test Classes in Salesforce
Batch Apex
- [Instructor] Let's take a look at some batch Apex code. First we're going to review the scheduler and then the loader and then we'll look at how do we write tests for those. Basically, in batch Apex, we're going to set up a schedulable class that can then be used to schedule the loader, which is the code that's actually going to do the work. In our schedule class, we basically create our query. In this case, we're going to query for a set of quotes that are in a certain status. The first thing we're going to do is create this string, myLoader.query and we're going to grab that quotes that are in the status called myStatusSet and then here we're going to set those values. We're going to query any quote that needs review, that's in review, or that's been presented. We then execute this ID batchprocessid Database.executeBatch. That will then schedule this quote loader to execute. In this case, we don't really have any code here, but what I wanted to show you was when we're actually…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.