+ Start a Discussion
rosscorossco 

Multiple Related Objects

Hi

 

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

Ross

kpeterskpeters

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 Force.com IDE to see the relationship name.

McFitz13McFitz13

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

 

 

orig: Delgate__C.Contact__r.id
new: Delgate__C.Contact_2__r.id

 Hope this makes sense.