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

Multiple Related Objects



I have a custom (Delgate__C) that has two lookups to the Contact table. When there was only one lookup I accessed the Contact data via the Contact__R object. Now that there are two, how to I reference the second related contact  and how does Salesforce know which one I am referring to?


Thanks in advance



You can look in the SFDC Setup interface to see the API Name of the field and replace __c with __r.  You can also look at the Foreign Key attribute of a field in the salesforce.schema via the IDE to see the relationship name.


Simply reference the other custom field the same way.

The new field has to have a different api name...where in your original call the field api name was contact__c




 Hope this makes sense.