Field dependencies.
So what I feel dependencies as the name says fee dependency meaning you value in a field depends on
the value of another field.
As simple as that one field is dependent on the other that is called this field dependency.
In fact it is a very common scenario that we encounter in our day to day life.
Let's say for example in any comas website or in any online transaction that we do we encounter this
particular concept.
Say for example when we give our address you know we have a pick list for country all right.
And when we choose a country say for example United States and then we have another pick list for state
and that list don't all the states of that particular country.
So if we choose USA all the states in USA would be listed.
If we choose Canada then different.
If we choose another country then the values and the state pick list will differ.
So based on the country that the selected the values actually appear in the state pick list that differs.
So this is a very simple concept of dependent pick list.
So the value of one field that is a state pick list is dependent on the value of the country pick list.
Now let's understand how we create this concept and a blatant sense force.
So open our sales force application for understanding this concept of field dependency what have done
this for the instructor object.
I have created a tool because fields one is a category field.
The other is a subcategory field.
All right.
It may not really apply for this particular scenario of the instructor object but just for understanding
the concept I have created these two pictures fields.
One is the category field and the other is a subcategory field and both these fields are visible in
the UI.
For the category fields for field type have chosen three values Category 1 Category 2 Category 3 and
for the sub category
for this big list.
After using these values sub category 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 2 3 3.
All right.
So now that both are a pick list fields are ready.
Let's clear the field dependency.
So how do we create a fuel dependency.
Go to the object definition page and in custom fields and relationships.
You would see an option fill dependencies ship the fuel dependencies button.
As we see there are no fuel dependency assets created let's create one hit the new button.
And here we see the controlling field and the dependent field.
So what does this.
So basically a controlling field is the one that controls what all the values to be displayed in the
dependent field.
Your quick description of that is given here.
So you know what is the controlling field is the category field right.
So let me just category and dependent field would be the subcategory.
So I chosen subcategory here.
The Continue button and then this is basically this is the market exactly showing us the values of whole
wheat has to be displayed so for category 1 category the subcategory values I'm choosing these three.
Just double click on that and they will get enabled for Category 2 Choose the values and 4 Category
3.
These are the values all right.
So these are the values the subcategory values for the respective category values.
So once done he'd save that there's also a preview button you can use that can see the values.
Now that the field dependency is perfectly created let's go to the instructor object.
Create a new record.
Let me create a test value.
And here you see there are two pick list.
This is the controlling field.
And this is their defining field.
So when I chose category 1 the options that I see only are Category 1 1 1 2 and 1 3 because these are
the three values that we chose for this particular category value.
And when you change the category the subcategory values also get changed 3 1 3 2 3 3.
All right.
So based on the value that we select in the category pick list the values and the subcategory pick list
changes meaning based on the value in the controlling field the value in the deepening field changes.
So this is the overall concept of field dependency
now that we have got a basic understanding of this concept of field dependency.
Let's take a quick look at the various concentrations that we have in this concept by number 1.
So of any talk about this concept of field dependency.
So which all of the field types that we can use as part of this field dependency concept.
There are only three field types that we can use for field dependencies checkbox the list multi selected
list only these three fields can be part of that field dependency concept
check mark fields can be controlling fields but not dependent fields.
Yes.
So when they say check Bob Fields it doesn't it is not that it can be bought controlling and dependent
checkbook fields can always be only controlling fields and it cannot act as dependent fields.
Let me show this to you in Salesforce UI This is a instructed object.
Let me go to the object definition page and here we have one checkbox field that is their training field
and now that if I tried to create the field dependencies
there's a training field is available only here that is a controlling field and that training field
is not available here.
The dependent field.
Right.
So it means checkboxes can only be a controlling field and not dependent field next consideration might
select big list can be deployed big list but not controlling fields.
You know it's the other way around.
So when you say multi selected list it can only act as dependent fields but not the controlling fields.
So might develop big list here in instructor object.
We have the monkey select big list of subject areas so let me hit cancel and now let me create a new
feel dependency and the controlling feel.
I do not see that multi select a subject area and independent field I see subject areas meaning my deselect
pick list cannot.
So ask controlling food but only at best dependent feeds perfect moving on.
Now let's talk about backlist feels now that we know check boxes vino multi select pick list how about
the regular pick list regular pick list can be either controlling or dependent feels however it depends
on whether it does a custom backless feel on a standard pick list feel custom pick list feels can be
either controlling order dependent feels there are no restrictions out there however the standard pick
list feels can be controlling for big list but not deep dependent feels all right.
So there is a difference.
So what we can do you can create custom backless fields and it can be both controlling and dependent
fields both the category and the subcategory fields that we created are custom fields so they can act
either as controlling or deep and in fields you know and that is all we see that category here subcategory.
So you know it can be both controlling and dependent the big list listed there are no restrictions out
there.
However the standard backless fields that are already available and sensible that can only act as controlling
fields and audit dependent fields and the next consideration.
This is why converting the existing fields to dependent big list this is pretty much the same scenario
that we replicated.
The category Big List and the subcategory pick list was already existing and then we converted them
to dependent on the controlling pick list right.
So what happens in the scenario when the pig list are already existing and you already have data for
that and then we convert them to dependent pig list of controlling fields.
Then what happens in that scenario.
It doesn't affect the existing values however after conversion interdependent controlling fields the
dependent rules will apply to only the new records and there will be no changes to the existing data
in the application.
So all of these considerations as and when we learn like it is it'll be definitely a good learning experience
for us to recreate the scenario in the UI and seeing how it behaves.
Moving on about the fee level security settings border controlling and the dependent fields are tied
logically the field level security settings are independent so always remember the field level security
for the control field and the deepening field are independent.
So just in case you hired a controlling field for some reason also hide the deepening pick list so it
makes logical sense out there.
The data import wizard doesn't consider field dependencies meaning why we use these data tools it.
Basically consider the logical relationship between those two fields.
If you basically consider whatever input data as just data and upload it so it is our responsibility
to ensure that the controlling field and the deepening field values are as part of the logical relationship
between them.
So these are some of the considerations that we need to note while creating field dependencies.
And of course it would be a good learning experience for us to replicate these scenarios in the UI and
see how it behaves.