What is field dependency?
Field dependency means, controlling a fields value based on the other field. For example, there are two fields called Country & State. I want to display only states related specific selected country when I select country.
More point about dependent fields
- The value selected in the controlling field affects the values available in the dependent field.
- A dependent field works in conjunction with a controlling field to filter its values.
- We can define custom picklist fields as controlling or dependent fields.
- Standard picklist filed must be controlling fields. We cannot define standard picklist fields as dependent fields.
- We can define default values for controlling field. But we cannot define default fields for dependent fields.
- We cannot define multi-select picklist as controlling.
- We can define checkbox as controlling field only.
Below table may helps you to understand about which fields can be used as controlling & dependent fields.
|Data Type||Can we define as Controlling field||Can we define as Dependent field|
|Multi-Select pick list||No||Yes|
Creating a field dependency fields
To create field dependency
– Go to setup menu and select the object you want to create field dependency.
– Click on filed dependency button & select controlling and dependent fields. See the below screen for reference.
Click on continue and select dependent fields under controlling fields. click on include & then Save. see the below screen for reference.
Field dependency is created now. To test this go to Country field and select USA, In states you will get only States related to USA ( Alabama, Alaska, Delaware & Florida) as defined above.