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
RiverChaserRiverChaser 

SOQL Query: Different Results in Apex Code and sforce Explorer

I have some custom Apex Code that runs this query, which works beautifully:

Code:
SELECT Id, Expiration_Date__c, Product__r.Name 
from Membership__c
WHERE Contact__r.Id = :contact.Id
AND Product__r.Name = 'Membership'
ORDER BY Expiration_Date__c DESC Limit 1
I'm now trying to run this same query in sforce Explorer, in preparation for doing a similar query using the Apex API from a custom application. The only change I've made is to include a string for the ContactID:

Code:
SELECT Id, Expiration_Date__c, Product__r.Name 
from Membership__c
WHERE Contact__r.Id = 'XXXXXXXXXXXXXXXXXX'
AND Product__r.Name = 'Membership'
ORDER BY Expiration_Date__c DESC Limit 1
But Explorer reports an error: "Query failed: MALFORMED_QUERY: SOQL statements can't query related data."

Why can I query related data in one usage but not another?

Thanks for any insight!
Don
 



 

DevAngelDevAngel
You must be using an older version of the Explorer, try obtaining the "latest" version.
RiverChaserRiverChaser
Interesting. I tried it in apex Explorer 8.0, and the query works.

What is the difference between apex Explorer and sforce Explorer? Is apex the updated version?

Thanks!
Don
DevAngelDevAngel
One was built before we supported relationship queries.  Also, the soap endpoint determines certain capabilities.

Cheers