-2
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){}
   }
1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.