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
jwillansjwillans 

Multiple values on "Lookup Relationship"

Is it possible to define a "Lookup Relationship" that can be bound to multiple values? This seems a fairly fundamental part of data modelling, perhaps there is an alternative way of achieving the same end?

Thanks,

James
RickyGRickyG
If you want a one-to-many relationship, which it sounds like you do, you should use a master-detail relationship.

Hope this helps.

- Rick Greenwald
Developer Evangelist
jwillansjwillans
Hi Ricky,

Thanks for the response. Yes I do want a one-to-many relationship. Perhaps I am using the master-detail incorrectly, when I create one of these I only get the opportunity to select a single value from a pick list. This seems to be consistent with the apex description of master-detail relationships:

"Creates a required ("Master-Detail") relationship with another object. This allows users to click a lookup icon () and select a value from a pop-up list. You specify the related object that sources the items in the list."

Can you help further?

Thanks,

James
RickyGRickyG

You define the master-detail relationship from the detail object - so the description is correct.  The master in this relationship is the object the relationship is pointing to - step 6 of the creation wizard specifically asks you what the related list should be named on that object, which is where the many portion is displayed.

Hope this helps.

-RIck Greenwald

Developer Evangelist

jwillansjwillans
Thanks Rick, that now makes sense.

James
RickyGRickyG
One correction.  Both master-detail and lookup relationships allow multiple detail records to be associated with another record, and both types of relationships cause the creation of related lists.  The difference between the two relationships involves a number of things, including whether a related child is deleted when the parent is deleted.

For more information, please refer to the on-line help.

Sorry for any confusion.

- Rick Greenwald
Developer Evangelist