I got some advice a couple days ago to improve my batch updater class. I have been working on it but am getting a compile error. I get the error:

DML requires SObject or SOBject list type: Map Line 20

The line is where I update the map pipelines. Why do I get this if I have Map pipelines = new Map(); in the method?

Code example:

global void execute(Database.BatchableContext BC, List<Revenue_Pipeline_Schedule__c> scope) {

    Map<Id, Revenue_Pipeline__c> pipelines = new Map<Id, Revenue_Pipeline__c>();

    for (Revenue_Pipeline_Schedule__c schedule : scope)
        Id pipelineId = schedule.Revenue_Pipeline__c;
        pipelines.put(pipelineId, new Revenue_Pipeline__c(Id=pipelineId));
    // now all keys are initialized

    for (Revenue_Pipeline_Schedule__c schedule : scope)
        SObjectField field = RevenuePipelineScheduleUpdaterHelper.dateToField.get(schedule.Date__c);
        if (field != null)
            pipelines.get(schedule.Revenue_Pipeline__c).put(field, schedule.Amount__c);
    update pipelines;

1 Answer 1


You can't update SObjects using a map. You have to do:

update pipelines.values();

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.