For the custom (reference) fields the relationship name is the same as field name, the only difference is that relationship name ends with __r and field name with __c

Example :

  • field name : Account__c
  • relationship name : Account__r

What is the logic for the standard fields & relationships ?


It's different for Accounts, since they have a hierarchy:

  1. ParentId will give you the Id
  2. Parent.Name Will return the parents name.

In general it would be

SELECT AccountId, Account.Name FROM Contact

As documented here

  • So for standard fields the field name looks like somethingId and the relationship name like something? example : OwnerId, Owner – benahm Oct 25 '17 at 6:50
  • @benahm Yes, you are right! – Basti Oct 25 '17 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.