+ Start a Discussion

Creating a many to many relationship with a standard object and a custon object.

I have a quick question.  I am trying to create a many to many relationship via a junction object for a standard object (Opportunities) and a custom object (3rd Party Contacts).  However when I create the junction, call it 3rdpartyopportunity association, and create the Master-Detail Relationships, the look-up boxes don't work properly.  I think I might have set up the junction object incorrectly.  Can anyone guide me / walk me through the process of setting up the junction properly?


What I am looking for is that basically multiple 3rd party contacts can be associated with an Opportunity and vice versa, many Opportunities can be associated with a single third party contact.  I would like for these relationships to be able to be linked. 


Thanks for your help,



Ankit AroraAnkit Arora

Can you please tell me how the lookup boxes on the junction object. And what is the actual/expected behavior?



Ankit Arora

Blog | Facebook | Blog Page


In my line of work, we have 3rd party contacts in addition to regular contacts.  I have created a custom "3rd Party Contact" object and Tab.  Both this custom object and the regular Opportunities object have a many to many relationship.  Thus an Opportunity can have multiple 3rd party contacts associated with it and vice versa, a 3rd Party Contact can have multiple Opportunities associated with it. 


This being the case I would like to have a lookup filed on the "Opportunity" tab that would allow me to link multiple 3rd party contacts that are associated with a certain Opportunity.  Similarly, on the "3rd Party Contacts" tab I would like to have a lookup filed that would allow me to link multiple Opportunities to a certain 3rd Party Contact. 


From my research it was my understanding that in order to create this "Many to Many" relationship I needed to created a junction object and then associate two Master-Detail Relationships.  I titled the custom junction object "Opportunity3rdPartyContactAssociation".  One Master-Detail relationship would be with Opportunities and the other would be with my custom 3rd Party Contacts.  


The "3rd Party Contacts" lookup box was searching all of the "Opportunities" database and the "Opportunities" lookup box was searching the "3rd Party Contacts" database.  I am not quite sure where I went wrong, or how I messed things up. 


If there is an easier way of doing this please let me know!  Any help you can provide will be much appreciated!


Thank you!






I understood below from your description:


two Objects:


Opportunity(Std Obj)3rd Party Contact(Custom Obj)

|   |

|_________       ---------------------|

(Opportunity3rdPartyContactAssociation) Junction Object 


And again there is a

Look Up on Opportunity for 3 rd Party Contact and 

Look up on 3 rd Party Contact for Opportunity


And the Problem is that  Lookup on Opportunity is not picking up the 3 rd Party contact  records which you have created under Opportunity3rdPartyContactAssociation Object and vice versa.


If this is the issue that i have understood correclty then  i think salesforce will not be able to filter the 3 rd Party Contacts that you have associated it under Junction Object and display it under Opportunity since both the LookUp relationship and Junction are different type of configutation and more over there is not unique Id concept which can fillter the records under the Objects


If i have not understood your problem, then might be some SFDC expert will try to help you out on this