You need to sign in to do that
Don't have an account?
APEX Batch
I have a webservice which will return me Any changes to Accounts happened in the last 7 days.
So basically I wrote a method which calls the webservice and parse the soap response and updates all the account records.
If i put this in batch I dont have any querylocator rows for my batch to pass onto Execute.For that i am returning a dummy row .
global database.Querylocator start(Database.BatchableContext context){
//Get all the Account Records whose docket numbers are not empty
return Database.getQueryLocator([Select Id, Name From Account Limit 1]);
}
//Method to execute the batch
global void execute(Database.BatchableContext context , List<sObject> scope)
{
ErrorMessage = Carrier411Service.UpdateChangedCarriersBatch();
}
For some reason its not even calling the UpdateChangedCarriesBatch. Am i missing anything..
How do i implement a batch where there is no querylocator. My webservice is giving me all the updated carriers.
Any help is appreciated.
Thanks,
Bharath
in start method you can return a query locator or a list of sObject.
to make a callout from a batch you must uses: Database.AllowsCallouts in its declaration, so:
global class BatchUpdateChangedCarriers implements
Database.Batchable<SObject>,Database.AllowsCallOuts {
I am already doing that in my class. My question is I dont need database.QueryLocator because my batch gets the records to be updated from the webservice not from the batch.Hope I made myself clear.