You need to sign in to do that
Don't have an account?
Access an Account Id in test class
Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107"
Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement? Thanks!
//set up records User U = [select id from USer limit 1]; //setup Account record Account Acct = ([select id, type__c from Account limit 1]); Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);
Since you are trying to access existing org data so try using before test method or test class
All Answers
Since you are trying to access existing org data so try using before test method or test class