Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 13 down vote accepted

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) {
     ...
}
share|improve this answer
1  
Perfect. Thanks Jesse! –  dfo Jan 18 '13 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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