function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
h20riderh20rider 

Access to object in a test class

I have a few test classes where i I running under a different user

 

When I can quering objects I am getting 0 rows.  For example  the custom object: Pipeline_Stage__c

where I looked at sharing I see this.

 

Pipeline Stage

Public Read OnlyChecked

 

Any Ideas why I am not able to see all the records

Best Answer chosen by Admin (Salesforce Developers) 
JitendraJitendra

Hi,

Please use the "IsTest(SeeAllData=true) Annotation" annotation in test class to fetch the record. 

 

Please have a look on this help document.

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_isTest.htm

All Answers

JitendraJitendra

Hi,

Please use the "IsTest(SeeAllData=true) Annotation" annotation in test class to fetch the record. 

 

Please have a look on this help document.

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_isTest.htm

This was selected as the best answer
h20riderh20rider

thanks.  That worked.  Ideally I want to have it be able query the data under that user.  But at this time, I just want code coverage

 

thanks again