+ Start a Discussion
Craig JonesCraig Jones 

Long selectlist... any other way?



I have a junction table that stores a Product custom object and the Account it is linked to. I initially implemented a select list on my custom visualforce page, which would list all the accounts linked to the Product selected. However, it now seems that a Product can have hundreds of accounts linked to it, which means my select list is huge!


Is there another way that anyone can recommend to display the accounts? Initially i was hoping to do something like the lookup field, or another search mechanism.


Any advice on implementation for this?


Thanks in advance,


You could do a lookup field, or perhaps an AJAX-based auto-complete mechanism. This will become more important as you approach a large list, since Visualforce has limitations on the size of select lists.
Craig JonesCraig Jones

Would you be able to help me understand how to implement a lookup field that i can supply a list of objects to? Ideally, i would like to use this method but i have struggled whilst trying to find example implementations. I can only seem to have a lookup field working when creating a new object... every other time it seems to be non-editable

A typical means of doing this is by creating a "phantom" object for the purposes of generating a lookup field. This may or may not suit your purposes though. If you look on the AppExchange, there's some publicly available packages that outline how to create an AJAX-based lookup based on keystrokes. There's probably also something here on the forums, though I couldn't say where off the top of my head. If I find something, I'll let you know.