• vw
  • NEWBIE
  • 5 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi there, I've created a public class called SponsorshipMaintenance that has a public method UpdateSponsorshipCountry. Looks like this:

public class SponsorshipMaintenance {
   
    public void UpdateSponsorshipCountry(List<Sponsorship__c> Sponsorships, List<Id> ChildIds){
          // .... some code here
   }

}

The class compiles with no errors. When I try to compile a trigger that has a call to the UpdateSponsorshipCountry method, I get the message "method does not exist or incorrect signature" on the line that calls the method. The trigger looks like this:

trigger SponsorshipSetCountry on Sponsorship__c (before insert, before update) {   
    //get list of sponsored child Ids of new sponsorships
    Id[] SponsoredKids = new Id[]{};
    for (Sponsorship__c spons : Trigger.new){
        SponsoredKids.add(spons.Child__c);   
    }
   
    //call method to set the correct country on the sponsorship objects
    SponsorshipMaintenance.UpdateSponsorshipCountry(Trigger.New,SponsoredKids); //this is the line that's generating the error. If I comment it out, the trigger compiles.
}

Any guidance would be most appreciated. Thank you!

  • October 21, 2007
  • Like
  • 0
Hi there, I've created a public class called SponsorshipMaintenance that has a public method UpdateSponsorshipCountry. Looks like this:

public class SponsorshipMaintenance {
   
    public void UpdateSponsorshipCountry(List<Sponsorship__c> Sponsorships, List<Id> ChildIds){
          // .... some code here
   }

}

The class compiles with no errors. When I try to compile a trigger that has a call to the UpdateSponsorshipCountry method, I get the message "method does not exist or incorrect signature" on the line that calls the method. The trigger looks like this:

trigger SponsorshipSetCountry on Sponsorship__c (before insert, before update) {   
    //get list of sponsored child Ids of new sponsorships
    Id[] SponsoredKids = new Id[]{};
    for (Sponsorship__c spons : Trigger.new){
        SponsoredKids.add(spons.Child__c);   
    }
   
    //call method to set the correct country on the sponsorship objects
    SponsorshipMaintenance.UpdateSponsorshipCountry(Trigger.New,SponsoredKids); //this is the line that's generating the error. If I comment it out, the trigger compiles.
}

Any guidance would be most appreciated. Thank you!

  • October 21, 2007
  • Like
  • 0