You need to sign in to do that
Don't have an account?
Error: Compile Error: Illegal assignment from LIST:SOBJECT:RevenueForecast
I'm a newbie who has encountered a compile error that I suspect is caused by a basic syntax error, but despite many searches and attempts to fix myself no luck. Any help is much appreciated!
exact error:
Error: Compile Error: Illegal assignment from LIST:SOBJECT:RevenueForecast to LIST:RevenueForecast at line 6 column 5
public class showRevenue{
private List<RevenueForecast> revenueforecast;
public List<RevenueForecast> getRevenueForecast()
{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate<=2009-01-01 Order By OwnerId];
return revenueforecast;
}
}
You have an apex class caused RevenueForecast, and so, your declration of list<RevenueForecast> is declarling a list of this apex class, but the query returns a list of the SObject RevenueForceast, a different type of object. you can either rename your apex class, or use the fully qualified name of the sobject version, Schema.RevenueForecast, e.g.
private List<Schema.RevenueForecast> revenueforecast;
public List<Schema.RevenueForecast> getRevenueForecast()
{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate<=2009-01-01 Order By OwnerId];
return revenueforecast;
}
}
All Answers
You have an apex class caused RevenueForecast, and so, your declration of list<RevenueForecast> is declarling a list of this apex class, but the query returns a list of the SObject RevenueForceast, a different type of object. you can either rename your apex class, or use the fully qualified name of the sobject version, Schema.RevenueForecast, e.g.
private List<Schema.RevenueForecast> revenueforecast;
public List<Schema.RevenueForecast> getRevenueForecast()
{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate<=2009-01-01 Order By OwnerId];
return revenueforecast;
}
}
Simon -
You fixed an issue that has been my nightmare for days - thanks so much for the help!!
Meghan