Timeline for Valid SOQL Query returning zero results in class but expected results in developer console
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 6, 2019 at 16:29 | answer | added | satyajit chanda | timeline score: 0 | |
Apr 17, 2018 at 17:25 | history | edited | Adrian Larson♦ |
edited tags
|
|
Apr 17, 2018 at 17:24 | vote | accept | MattGarnett | ||
Apr 17, 2018 at 17:24 | answer | added | Adrian Larson♦ | timeline score: 0 | |
Apr 17, 2018 at 17:23 | comment | added | Adrian Larson♦ |
Posting answer now. FYI if you @mention someone they'll get a notification. :)
|
|
Apr 12, 2018 at 14:48 | comment | added | metasync | Unless you add @SeeAllData annotation (to be honest, using that annotation is not a good idea) | |
Apr 12, 2018 at 14:38 | comment | added | MattGarnett | I'm a complete and utter idiot. Thanks Adrian. Feel free to post as an answer I'll mark it up. | |
Apr 12, 2018 at 14:33 | comment | added | Adrian Larson♦ | Are you getting the error in a unit test? You have to create your own test data... | |
Apr 12, 2018 at 14:21 | comment | added | MattGarnett | Permissions isn't the problem as I have full access to the object as system admin. All other SOQL queries in the code work fine. It's just the urgencies and the impacts. Substituting for the code you suggested returns a count of 4 within the developer console and 0 within my class test execution. | |
Apr 12, 2018 at 14:03 | comment | added | amanda fouts | Have you tried to substitute "SELECT Id, Name" with "Select count() FROM BMCServiceDesk__Urgency__c"? Also, have you tried to open up permissions for BMCServiceDesk__Urgency__c all the way, trying your query again, then closing them back to what they were after troubleshooting just to see if it is a permissions issue? Also, I might try commenting out all of the code in the file except the query, then half the file, etc. | |
Apr 12, 2018 at 13:52 | history | edited | MattGarnett | CC BY-SA 3.0 |
added 4986 characters in body
|
Apr 12, 2018 at 13:34 | comment | added | David Reed |
What context is the query running under in Apex? Is the class with sharing or without sharing ? Is the class executing with you as the context user?
|
|
Apr 12, 2018 at 13:33 | history | asked | MattGarnett | CC BY-SA 3.0 |