global class WeatherBatch implements Database.Batchable<sObject>,Database.AllowsCallouts{
String query;
global Database.querylocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<String, Object> records) {
List<Weather_Forecast__c> forecast = new List<Weather_Forecast__c>();
for (List<String, Object> record : records) {
forecast.add(
buildforecast(record)
);
}
insert forecasts;
}
global void finish(Database.BatchableContext BC){}
}
Add a comment
|
1 Answer
There is nothing called as List<string,Object>
in apex.
Replace your below code
global void execute(Database.BatchableContext BC, List<String, Object> records)
with
global void execute(Database.BatchableContext BC, List<sObject> records)
Signature for execute method is
public Void execute(Database.BatchableContext jobId, List<sObject> recordList)
So it takes Database.BatchableContext
and List<sObject>
as parameters, whereas in your code your execute methods takes incorrect values. You can learn more about batch classes at Batchable Interface documentation.