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
Javier MaldonadoJavier Maldonado 

Drop Down List using look up from a different object, to show all items filtered by family

I'm working now in an special project, and I would like to use visual flow to build this app, so in one part of this project, there is a requirement of show a look up option, as drop down list, to bring a full list of items filtered by family, from Product Object

​Has somebody done this before?, Any Example???
Best Answer chosen by Javier Maldonado
Abhi_TripathiAbhi_Tripathi
Hi Javier,

To do that in visualforce page its and easy peasy thing.

If you want the records of a particular object in the picklist then just do as follows

1. In the controller query the records (Must having a limit )and add it to a SelectOption list.
2. Show that SelectOption list on VF PAGE.

Somthing like this 

//Select list of Product
List<SelectOption> productList = new List<SelectOption>();
productList.add('--None--', '');

//Query Product records and add to selectOption list
for(Product2 pr : [Select Id, Name From Product2 Limit 10]) {
       productList.add( pr.Name, pr.Id);
}

Note : This code is not tested just written for an example

Regards,
Abhi Tripathi
Salesforce Developer
http://abhithetechknight.blogspot.in/

All Answers

Abhi_TripathiAbhi_Tripathi
Hi Javier,

To do that in visualforce page its and easy peasy thing.

If you want the records of a particular object in the picklist then just do as follows

1. In the controller query the records (Must having a limit )and add it to a SelectOption list.
2. Show that SelectOption list on VF PAGE.

Somthing like this 

//Select list of Product
List<SelectOption> productList = new List<SelectOption>();
productList.add('--None--', '');

//Query Product records and add to selectOption list
for(Product2 pr : [Select Id, Name From Product2 Limit 10]) {
       productList.add( pr.Name, pr.Id);
}

Note : This code is not tested just written for an example

Regards,
Abhi Tripathi
Salesforce Developer
http://abhithetechknight.blogspot.in/
This was selected as the best answer
Javier MaldonadoJavier Maldonado
Abhi,

Thanks for your replay... But, I'm looking for do this using Visual Flow, I'm trying to avoid code...
Javier MaldonadoJavier Maldonado
Hi Abhi,

After drain all my resources trying to build my app using Flow Designer, unfortunately is impossible... so my only choice is start coding, but precisely I was avoiding it coding, because I'm not good enough in this matter, basically my experience is BVA, and I've discovered that is not even similar... so Can you be a little bit more specific with your above instruction, or maybe you have a example that can let me start working on this, I will try to do it by myself. Thanks in advance.
Abhi_TripathiAbhi_Tripathi
Hi Javier,

Here is a post that I am refering you, it have an code snippet where you will get the code of populating a Select list and how fetch the selected option in Apex class.

Please go through this post, let me know if you find any issue
http://abhithetechknight.blogspot.in/2013/09/salesforcecom-custom-dataloader.html

Regards,
Abhi
Javier MaldonadoJavier Maldonado
Thanks Abhi,

Sure I will, I'm going to check this out, because my first step is understand the code... but anyway, If I'm in trouble I'll let you know... THANKS...