+ Start a Discussion
mwunderlichmwunderlich 

How to create a multi-select lookup relationship

Hi all,
 
Just getting started on force.com coding, I have run into a first problem: How do I create a multi-select lookup relationship between two custom objects? What I would like to have is basically a multi-select picklist, which is populated with the names of another cucstom object, so essentially creating a one-to-many relationship between my two custom objects.
How could I achieve this? Thanks a lot in advance.
 
Kind regards,
 
Martin
werewolfwerewolf
In Summer '08 you'll be able to use Many-to-Many Relationships to achieve this:

http://blogs.salesforce.com/features/2008/05/many-to-many-ob.html

Give it a few days and you can try it out...
mwunderlichmwunderlich
Thanks a lot for the reply. What I don't understand is how the many-to-many-realtionship would give me the multi-select picklist that I am looking for. As far as I can see, a one-to-many relationship, which already exists, would be sufficient for this.
 
Cheers,
 
Martin
werewolfwerewolf
If you turn on the new dropdown lookups I think you'll find that the functionality will approximate what you need.  The problem with trying to use multiselect picklists in this type of use case is that in most cases, the number of rows of objects on either side of the relationship may well exceed the number of items which are feasible to show in a multiselect picklist (said number being very small, even 20 is probably too many), so lookups are likely the better choice.

If you really do want some kind of picklists you can create such an interface fairly simply with Visualforce and back it with a many-to-many linking object.
Lance007Lance007

Is this soon to be released?

http://blogs.salesforce.com/features/2008/05/many-to-many-ob.htmlhttp://blogs.salesforce.com/features/2008/05/many-to-many-ob.html

werewolfwerewolf
That's already released.  It's just a custom object with 2 master-detail relationships.
werewolfwerewolf
It was released in Summer '08 in June.
OscarSFOscarSF

Hi, I need the same. I made a one to many relationship between "contract" and "assets". Basically what I need to be able to do is add as many "assets" as needed to "contract". So "contract" has many "assets". The field generated for now only allows me to select one asset. Please let me know how to solve. Thanks in advance! 

Dario BakDario Bak
Hi Oscar, you need to create a third object and create 2 one-to-many relationships. This is called a JOINT object.
https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm

Click like if this was useful!