Search code examples
salesforcesoql

Didn't understand relationship 'opportunity__c' in field path.


Select id, Account.Type from opportunity__c

I create a custom object opportunity and make relational on Account__c and account data type lookup but above query does not run and give below error

"Select id, Account.Type from opportunity__c ^ ERROR at Row:1:Column:12 Didn't understand relationship 'Account' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."


Solution

  • Sounds like account is a custom field, in which case the field is called account__c, and the relationship is called account__r so your query should be select id, account__r.type from opportunity__c