You need to sign in to do that
Don't have an account?
GWebber
Variable does not exist Error
I'm new to VisualForce. I've been following the tutorials, but I can't for the life of me get this variable declared properly it seems. Anyone have an idea why it would think that opp doesn't exist as a variable?
public class RevenueProjectionController { public Opportunity opp { get; set; } public RevenueProjectionController() { opp = new Opportunity(); } public static List<Opportunity> getEvents() { return [SELECT Id, Name, Account.Name FROM Opportunity WHERE Event_Date__c >= :opp.Event_Date__c ORDER BY Probability, Event_Date__c]; } static testMethod void testCases() { List<Opportunity> test = new List<Opportunity>(); test = getEvents(); } }
Your static method getEvents is trying to access a member variable. It can't do that. You need to make it nonstatic, and create an object in the test method to invoke it on....
All Answers
Your static method getEvents is trying to access a member variable. It can't do that. You need to make it nonstatic, and create an object in the test method to invoke it on....
Thanks much sir. Stupid issue, I know, but thanks for clearing it up for me!