I created a custom object in Salesforce to create new employee records. In that form, the employee needs to select the country and state of their native place.
However, the requirement was that I needed to modify the country and state fields so that when an employee selects a country, only the related state should be displayed in the state field.
For that, we have a field dependency feature in Salesforce, and I achieved this requirement using it.
In this Salesforce tutorial, we will learn about field dependency. I will explain step-by-step how to set up field dependency in Salesforce.
Field Dependency in Salesforce
In Salesforce, when we select a controlling field, the other field(the dependent field) should show only values related to the controlling field.
This is called field dependency. Using field dependency, we can save time and quickly create records.
Uses of Field Dependency
- Using field dependency, we can filter dependent field values based on the value we selected in the controlling field.
- It enhances accuracy when creating records, as selecting the controlling field in the dependent field displays only values related to it.
Controlling Field in Salesforce
- The controlling field decides the behavior of the dependent fields. There are three Controlling Fields in Salesforce:
- CheckBox.
- Standard Picklist.
- Custom Picklist.
Dependant Field in Salesforce
- The dependent field shows only those values related to the controlling field; in the dependent field, we can set which value should be displayed according to the controlling field. There are two Dependent Fields in Salesforce:
- Custom Picklist.
- Multiselect Picklist.
Dependent Picklist Considerations
- After converting the existing field to a controlling or dependent field, it does not affect your existing records. It will apply to new records.
- Before creating a field dependency, make sure your picklist field has at least one Picklist Value.
- If you change the existing controlling field value, then the dependent field value will lost.
- The controlling field must be present in the Page Layout because if it is missing, the dependent picklist values don’t appear.
- Make sure the dependent picklist is lower on the page layout than the controlling field.
Now, l