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
Lance007Lance007 

Lookup that allows one to many

I'm trying to add a custom field which would be a lookup and allow a one to many relationship. I need to associate Contacts with a Contract or Multiple Contracts. I dont need or want to create a new Contract from the Contact page, I simply want to associate a Contact with one or many Contracts. I've called SF support about this, but they seem to be baffled by this idea. Any help would be appreciated.
werewolfwerewolf
All lookup relationships are one to many.  If you make a lookup from Contract to Contact then you can have as many Contracts as you want looking up to that Contact.

If what you mean is a many-to-many relationship, where one Contact can be associated with many Contracts and one Contract can be associated with many Contacts, then you'll want to make a custom junction object, which is basically a custom object that has 2 master-details.  In your case one would be to Contact and the other to Contract.
Lance007Lance007
Thanks Werewolf. Is there any documentation, or a step by step on how to do this? I've called SF several times about this, but support isnt familiar with how to do this.
Lance007Lance007
Does anyone know of any details/step by step on how to setup an object that has 2 master details?
 
"If what you mean is a many-to-many relationship, where one Contact can be associated with many Contracts and one Contract can be associated with many Contacts, then you'll want to make a custom junction object, which is basically a custom object that has 2 master-details.  In your case one would be to Contact and the other to Contract."
werewolfwerewolf
See my second post here:

http://community.salesforce.com/sforce/board/message?board.id=general_development&thread.id=20058
Lance007Lance007
I've tried to follow the post instructions, but when I get to the step:
 
3.  On this CJO create 2 master-details -- 1 to the Account and the other to your custom object.3.  On this CJO create 2 master-details -- 1 to the Account and the other to your custom object.
 
I can't proceed. When I try to creae the 2nd master detail from the Custom Object to the Custom Object, the Custom Object Name doesnt appear in the select list of objects to which I can relate.
werewolfwerewolf

Well what is the status of your other custom object?  Is it already master-detail to something else?  You can't make a master-detail relationship to an object that is already master-detail to another object afaik.

I haven't had any trouble making these so far.  For example, one CJO I made was between Case and a custom object I made called Bug (the CJO is called CaseBug).  It's generally as easy as just making a new custom object and 2 custom fields on it.

Lance007Lance007
Thanks Wolfy.  I figured it out. I used to Lookup relationships between the two objects using another object as the custom connnector.