You need to sign in to do that
Don't have an account?
Ty Whitfield
Issue with Batch Apex
I've tried the code below (removed some items for confidentiality) but I receive the "made it to the query locator" debug message but never receive the "made it to the execute" debug. I'm calling it by entering
batchGenerateAssets be = new batchGenerateAssets(); database.executeBatch(be);
in Execute Anonymous Window of the Developer Console
What am I doing wrong?
global class batchGenerateAssets implements Database.Batchable<sObject>, Database.AllowsCallouts{ public String query = 'Select Id, PakSize__c, ProductFamily, UsageEndDate, Product2Id FROM Asset WHERE SerialNumber = \'**Generate**\' '; global Database.QueryLocator start(Database.BatchableContext BC) { System.debug('made it to querylocator'); return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<Asset> assetList) { System.debug('made it to execute'); /////////////////////////////////////////////////////////////////////////////// } global void finish(Database.BatchableContext BC) { } }
All Answers
Did you check if the query in your start method is fetching any data to send to execute method? I think the execute method might not be called if there is no data to be processed. I am not completely sure though. Please check that aspect.
Thanks.
Yes, I do receive that 4 rows were returned which is what I expect .