Picklist Field in Salesforce & Field Dependencies in Salesforce

Picklist Field in Salesforce: Pick list field is Drop down list of values. Basically we use picklist whenever we have requirement that we need to create field with pre defined values, user should enter the value from the predefined list of values only. In that case we go with Picklist.

How to Create Picklist field in Salesforce:

Example: I need to create a fields those should store State information and City information of Student. In this case we can create Country and State fields with field type piclist. 

Field Label: State
Field Type : Picklist
Picklist Values: Andhra Prasdesh, Telangana, Tamil Nadu, Karnataka, Kerala..

Field Label: City
Field Type : Picklist
Picklist Values: Vijayawada, Vishaka Patnam, Eluru, Guntur, Jaggayyapeta, Khammam, Hyderabad, Warangal, Karimnagar, Chennai, Bengaluru, Kochhin.

Steps to create Picklist Field(State)
SETUP-->OBJECT MANAGER --> Student

Step 1. Choose the field type: Picklist
Step 2. Enter the details : Field Label should be "State", In Values select radio button "Enter the values, with each value separated by a new line". Enter country values like below Image.

Step 3. Establish field-level security
Step 4. Add to page layouts and Save. Now we are done with the creation of State picklist field.

Steps to create Picklist Field(S)
SETUP-->OBJECT MANAGER --> Student

Step 1. Choose the field type: Picklist
Step 2. Enter the details : Field Label should be "City", In Values select radio button "Enter the values, with each value separated by a new line". Enter country values like below Image.
Step 3. Establish field-level security
Step 4. Add to page layouts and Save. Now we are done with the creation of City picklist field.

If we go and create or edit student record we can see State and City picklist fields.

Field Dependency in Salesforce:

By using field dependencies in salesforce we can control the picklist values of  one picklist from another picklist value selection. If Controller picklist value changed then dependent picklist values automatically changed for user selection.

Example: Inn above example we created two picklist fields i.e State and City.  If we try to create Student record, irrespective of State section we are displaying all values on City picklist field. But if we create field dependency between State & City, based on State selection city picklist value's changed that means for example if we select Andhra Pradesh then corresponding city's(Vijayawada, Vishaka Patnam, Eluru, Guntur, Jaggayyapeta) only displayed on City field.

Important Note: Picklist which is controlling other Picklist field values called Controlling field. The field that has its values filtered based on other picklist field called the "dependent field."

How to create Field Field Dependency in Salesforce:
SETUP --> OBJECT MANAGER --> Student---> Field Dependencies --> New
1. Select State as Controlling Field and City as Dependent field.
2. Edit Field Dependency: We can see one column for every State and all the city's avilable in every column. See below screen
3. Select City's based on State. By using Ctrl+click. See blow image, like that select city values for every state.

4. Click on "Include Values" button. And click Save.

Now try to create new Student record, you can see magic. If you select Andhra Pradesh as State then you will see Vijayawada, Vishaka Patnam, Eluru, Guntuu, Jaggayyapeta in City field and if you select Telangana as City you can able to Khammam, Hyderabad, Warangal, Karimnagaer.

Post a Comment