You need to sign in to do that
Don't have an account?

MALFORMED_QUERY: SOQL retrieve statements cannot query related child data
I am executing the following query using the latest version (24) of the Salesforce API. The query posted below has only had minor edits (renaming fields and objects).
select Id, Name, Type, Owner.Email, OwnerId, BillingStreet, BillingCity, BillingCountry, BillingState, BillingPostalCode, BillingAttn__c, Phone, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, ShippingAttn__c, (SELECT Id, ContractNumber, Contract_Code__c, StartDate, EndDate, Description, CreatedDate, ActivatedDate, LastModifiedDate, ContractTerm, Status FROM Contracts), (SELECT Id, Name, CreatedDate, Contract_Code__c, Contract_Terms__c, Contract_Start_Date__c, Contract_End_Date__c, Status__c FROM Foo_Contract__r WHERE Status__c = 'Active' AND Contract_End_Date__c > 2012-05-22), (SELECT Contract_Start_Date__c, Contract_End_Date__c, Name, Id, Status__c, Contract_Terms__c, Foo_Id__c, CreatedDate FROM Foo_Contract__r)
from Account where Id = 'xxx' ORDER BY CreatedDate DESC
When I execute the query I receieve the following: MALFORMED_QUERY: SOQL retrieve statements cannot query related child data. The call is being executed using the retrieve method in the API.
Maybe this is specified in the documentation somewhere, but, it would seem to me that this would be a bug when calling the retrieve method. I changed my code to instead use the query method and the query I posted executes successfully and I am getting a record returned. The retrieve method must not support relationship queries (which seems like an odd design choice if this functionality is desired).