I'm running into the following error and not able to get around it. I've looked at a few other posts to help, including make the method static (which it is) and call the method in a different way (tried it), but neither worked.

Any ideas?

Save error: Method does not exist or incorrect signature: pipelineRepContactUpdateClass.myMethod(Set, Map)


trigger pipelineRepContactUpdate on Account (after update) {
    Set<Id> lst_acc_id = new Set<Id>();//Store the sets of Impacted Account for which you have changed the field value
    Map<Id,Id> map_accounId_OwnerId = new Map<Id,Id>();//map of account Id and OwnerId
    List<Contact> lst_updated_contact = new List<Contact>();//List of updated contact

    if(Trigger.isAfter && Trigger.isUpdate){ 
        for(Account  acc : Trigger.New){ 
            //Checks whether the value changes from previous one or not
            if((Trigger.oldMap.get(acc.Id).Pipeline_Rep__c != Trigger.newMap.get(acc.Id).Pipeline_Rep__c) &&  Trigger.newMap.get(acc.Id).Pipeline_Rep__c!=null){
                map_accounId_OwnerId.put(acc.Id,acc.Pipeline_Rep__c);//preparing the map

        // call class here (lst_acc_id,map_accounId_OwnerId)



public class pipelineRepContactUpdateClass {

    public static void myMethod(List<Id> lst_acc_id, Map<Id,Id> map_accounId_OwnerId){

        List<Contact> lst_updated_contact = new List<Contact>();//List of updated contact

            //query all the contact related to the Account
            List<Contact> lst_con = [Select Id,OwnerId,AccountId from Contact where AccountId IN : lst_acc_id];   
                for(Contact con : lst_con){
                    con.OwnerId = map_accounId_OwnerId.get(con.AccountId);// assigning the Account Pipeline_Rep__c field


            update  lst_updated_contact;//update the contact records



Your signature accepts List, and you are trying to pass Set.


Set<Id> lst_acc_id = new Set<Id>();


List<Id> lst_acc_id = new List<Id>();

Or you can change the signature from:

public static void myMethod(List<Id> lst_acc_id, Map<Id,Id> map_accounId_OwnerId)


public static void myMethod(Set<Id> lst_acc_id, Map<Id,Id> map_accounId_OwnerId)

Also a word on naming. I find that in general, your code will be much more reading if you entirely avoid specifying the collection type in the name (as here you have actually called it a List even though it is not). Also, you should indicate it is a collection simply by making it plural. A much better variable name here would be accountIds.

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.