+ Start a Discussion
crocodilecrocodile 

SOQL queries through APEX class always returning 0 rows..

SOQL queries from APEX code is always returning 0 rows for any Custom Object. Not showing any errors or exceptions simply it is showing as 0 rows. However the same query is returning several rows. I ran the APEX class from Force.com website and through IDE but from both the ways it showing 0 rows.

 

Plz suggest me why my APEX class returning 0 rows for all objects which is worked through  salesforce.schema

 

Thx in adv,

Vishwa

Best Answer chosen by Admin (Salesforce Developers) 
SeAlVaSeAlVa

You are not executing the query that returns 0 rows on a Test (class or method), are you?

 

if so, use @isTest(seeAllData=true) notation

All Answers

SeAlVaSeAlVa

You are not executing the query that returns 0 rows on a Test (class or method), are you?

 

if so, use @isTest(seeAllData=true) notation

This was selected as the best answer
crocodilecrocodile

Thank you.. now it is working.