Referenced Fields in SOQL Queries
I am trying to write a fairly straightforward SOQL query, which is not working how i'd expect.
// Substituting valid where criteria for etc...
sObject Temp = Database.query('SELECT Contact.Account.Name FROM Contacts WHERE etc.');
I get an 'Invalid field 'contact.account.name'' error whenever i try this.
I've tried these variations and all of their various capitalizations (not that it should matter)
Obviously, this works:
Contact Temp = [SELECT Contact.Account.Name FROM Contacts WHERE etc.'];
But I need to be able to build the query string dynamically, querying against arbitrary salesforce objects. I feel like i'm just missing something simple, but I've been over the documentation numerous times with no luck.
Any assistance anyone could offer would be greatly appreciated.
Creating Custom Buttons on Objects Dynamically
Message Edited by si402 on 01-19-2009 03:03 PM