Sunday 5 May 2013


Dependent Fields

Dependent fields are primarily used to define cascading picklists. Cascading picklists are a
user interface pattern in which the values in one picklist depend on the selection in
another picklist. For example, a picklist for state/province might depend on another picklist
for country.When a user selects a country, the state/province picklist is populated with
a set of values that make sense given the selected country. In Force.com, the first picklist is
called the dependent field, and the second is the controlling field.The controlling field
can be a standard or custom picklist (with at least 1 and fewer than 300 values) or a check
box field, but cannot be a multi-select picklist.The dependent field can be a custom picklist
or multi-select picklist.

A dependent field is an ordinary picklist field with an additional attribute to relate it to
a controlling field.To visualize the relationship between the fields, modify your object’s
page layout so that the controlling field appears above the dependent field.Then perform
the following steps to define the relationship between their values:

1. Navigate to the Custom Field Definition Detail page for the dependent field.
2. In the Picklist Options subsection, click the New link next to the label for Controlling
Field.
3. Select the controlling field and click the Continue button.
4. Use the grid to specify which values of the controlling field should be included in
the dependent field. Picklist values of the controlling field are shown as columns.
Values of the dependent field appear as rows. Double-click individual values to
include or exclude them or hold down the Shift key while clicking multiple values
and click the Include Values and Exclude Values buttons to make changes in bulk.

Dependent fields can be challenging to incorporate in dynamic user interfaces and are
not supported in Force.com Connect Offline.The main alternative to dependent fields is
a Lookup relationship between two objects that contain your valid values. If you already
have an investment in picklists and want to migrate, create two objects. One object contains
the values of the controlling field; the other contains the dependent field’s values.
Add a lookup relationship field on the second object, relating it to the first. Load the first
object with records, one for each of the controlling field’s picklist values.Then add
records to the second object, assigning them the correct parent controlling record.

No comments:

Post a Comment