I have an error popping up when I'm trying to call a method from another class. It's telling me the method doesn't exist or incorrect signature. Here's the breakdown of how it's working:
public with sharing class QuoteCalcUtil{
public String userEndDay;
public String userEndMonth;
public String userEndYear;
public void populateEndDates(String year, String month, String day)
{
userEndDay = day;
userEndMonth = month;
userEndYear = year;
}
}
I have another class which is actually a controller which gets the values of userEndDay,userEndMonth,userEndYear from a visualforce page based on the user input. I want these values to then get passed to the QuoteCalcUtil class.
//This is the controller class
public with sharing class Checkbox_Class_V2
{
QuoteCalcUtil utility;
public String userEndDay {get; set;} //these three string variables are directly received from the visualforce page based on user input
public String userEndMonth {get; set;}
public String userEndYear {get; set;}
public PageReference getSelected()
{
utility.populateEndDates(userEndDay,userEndMonth,userEndYear); //sending the user input values to the QuoteCalcUtil class using this method.
/more code here
}
}
The error occurs in the utility.populateEndDates line since it seems to be unhappy with the string parameters I'm giving it. Here is the exact error:
Save error: Method does not exist or incorrect signature: [QuoteCalcUtil].populateEndDates(String, String, String).
From what I can tell, I don't think i've done anything wrong. I've tried making the populateEndDates method a static method but that didn't solve it. I'm also instantiating the QuoteCalcUtil beforehand but again that isn't solving anything. From what I understand, those are the two ways to solve an error like this. Any ideas?
QuoteCaclUtil
rather thanQuoteCalcUtil
. Seems like a typo in Calc. – Daniel Ballinger Jul 10 '13 at 19:15utility.populateEndDates('','','');
work? Removing a parameters from the equation will narrow down the possible cause of the error. Maybe try creating an instance of QuoteCalcUtil and calling the method in anonymous Apex. – Daniel Ballinger Jul 10 '13 at 19:30