3

I have a trigger with following code -

trigger Project_Trigger on Project__c (before update) {
    PepsiProjectManager.projectBeforeUpdate(Trigger.oldMap, Trigger.new);
}

And a class with methods for this and other triggers -

public class PepsiProjectManager {
    ...
    public static void projectBeforeUpdate(Map<String, Project__c> oldProjectsMap, 
            List<Project__c> newProjects) {
        ...
    }
}

IDE says 'method doesn't exist or incorrect signature'.

This -

    public static void projectBeforeUpdate(Map<Project__c> oldProjectsMap, 
            List<Project__c> newProjects) {
        ...
    }

doesn't work either. The error is 'map must have exactly 2 arguments'. What is the first argument?

15

Trigger.oldMap should return a type of

Map<Id, sObject__c>

Try changing your code to

public static void projectBeforeUpdate(Map<Id, Project__c> oldProjectsMap, 
                                       List<Project__c> newProjects) {
     ...
}

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.