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
Ravi Sankar 12Ravi Sankar 12 

filtering picklist values of field A based on picklist value selected in picklist B

Hello All,

I have Picklist Field A with 16 values and picklist field B with 2 values(Mail/Email). Few values in Picklist A should have both email and mail so that user can select one. Few should have only one either mail/Email.  This is in lightning.

Please let me know the ways to do it.

Thank you for your help.
 
Leon ThanikalLeon Thanikal
Hi Ravi,

There is a very easy solution to this. If you already have the two picklists created, go to object manager and select the object with the picklists. Then click on Field & Relationships. On the top right, next to new, you will see a button called Field Dependencies. Click on it. Then click on new. Choose Picklist Field A as the Controlling Field and Picklist Field B as the Dependent Field. Then press continue. Then you will go to a new screen where you will have all the values for Picklist Field A as the columns and Mail and email under them. Go through the table and click on Mail/Email and select whether to include values or exclude values. Then click save and you should be all set.

Hope this helps!
Ravi Sankar 12Ravi Sankar 12
Hi Leon,

I want this on a lightning component. The dependent picklist option is not working here. Thank you.
Leon ThanikalLeon Thanikal
Hi Ravi,

I suggest you look at the below forum post:
https://developer.salesforce.com/forums/?id=9060G0000005pt3QAA

The sfdc link that is posted is very good and a great base to solve your question.
Kamesh SinghKamesh Singh
Hi Ravi,

Here is very good explanation for this issue.
http://sfdcmonkey.com/2018/08/31/dependent-picklist-lightningselect-lightning-salesforce/

Thanks,
Kamesh
Ravi Sankar 12Ravi Sankar 12
Thank you all for your suggestions. In this scenario I used custom metadata and handled in apex and passed the values to the controller. Appreciate your help