You need to sign in to do that
Don't have an account?
D J Roberts
How to use System.Debug in Batch Class?
Trying to check the query results in a Batch Class, but not sure what to call. The code is below. Any help would be great. Again, just trying to log the query result within a batch class.
global class LeadProcessor implements Database.Batchable<sobject>, Database.Stateful { global Database.QueryLocator start(Database.BatchableContext bc){ String query = 'Select Id, LeadSource FROM Lead WHERE LeadSource != \'DreamForce\'' ; return Database.getQueryLocator(query); } global void execute(Database.BatchableContext bc, List<Lead> records){ System.debug('Query Results = ' + bc()); // process each batch of records } global void finish(Database.BatchableContext bc){ // execute any post-processing operations } }
In debug log you probably able to see it once you open that file as shown in the screen shot below
Let me know if this help and don't forget to mark it best if helped.