You need to sign in to do that
Don't have an account?
SOQL query returning results in Force.com Explorer, but nothing in actual class
I'm usinf a sandbox trying to run a query to get back all open cases that I will then iterate through and do some work on. Here's my query:
SELECT CaseNumber, Status, IsClosed, IsDeleted, Owner.name, LastModifiedDate, Contact.name, Contact.Email FROM Case
In the Force.com Explorer, I get all the cases back, but when I run this in a class in my sandbox, I get no results (from the log output, that is). The below example was a test with pulling from the Account table:
09:59:09.617 (1617692000)|SOQL_EXECUTE_BEGIN|[10]|Aggregations:0|select Name from Account
09:59:09.621 (1621556000)|SOQL_EXECUTE_END|[10]|Rows:0
I'm pretty sure I'm hitting the same database, and I seem to see this behavior all tables that I've spot checked.
Any ideas?
If you are doing this in a test method, you either need to create test cases/accounts and insert them, or do @isTest(seeAllData=true)
All Answers
If you are doing this in a test method, you either need to create test cases/accounts and insert them, or do @isTest(seeAllData=true)
So if I'm running this through a test class (annotated with @isTest) then I actually need to insert data *IN* the test class before pulling it out? Will a @isTest class not pull real data from the Sandbox?
You, sir, are a gentleman and a scholar. Thank you.