Query Field Dependency for an Object in Salesforce
32 views
Jun 9, 2025
FieldDefinition can be used to Query/SOQL Field Dependency for an Object in Salesforce. Blog Post: https://www.infallibletechie.com/2022/01/how-to-querysoql-field-dependency-for.html
View Video Transcript
0:06
hello everyone in this video we are
0:08
going to see how to use Salesforce srql
0:12
to find out
0:13
field dependencies in an object
0:18
for this demo I created a custom object
0:20
called employee detail
0:25
here I created few pick list fields and
0:28
also other data type fields
0:32
if I go to field dependencies in my
0:34
employee detail object
0:36
I have one field dependency setup
0:41
state is controlling and the dependent
0:43
is City So based on the state I will be
0:46
able to select the city if I wanted to
0:49
use soql to find out this this and other
0:54
additional
0:56
field dependencies in an object
0:59
then we can make use of
1:05
select label comma qualified APA name
1:09
comma data type comma controlling field
1:12
definition dot developer name from field
1:16
definition entity where entity
1:19
definition
1:20
dot qualified APA name is is equal to X
1:24
the AP name of the object and
1:26
controlling field definition ID is not
1:29
equal to null
1:31
so here label is the label of the field
1:34
API name of the field
1:37
and the data type is what is the data
1:39
type whether it is a pick list multiplic
1:40
list check box
1:42
and next we have a controlling field
1:46
definition dot developer name so what is
1:48
the controlling Fields developer name we
1:50
can definitely find that
1:52
and uh entity definition dot qualified
1:55
AP name is the AP name of the object
1:59
and we are making sure controlling field
2:01
definition ID is not equal to null so
2:03
that we are getting only the controlling
2:06
field and and its dependent of values so
2:10
let's execute it so here
2:13
in my employee
2:16
detail object I have city which is the
2:20
dependent field which is of type data
2:24
type and the controlling field for that
2:27
particular point in this particular list
2:30
is state
2:33
if I remove this it will bring in all
2:36
the fields
2:39
that are available in this employee
2:41
detail object
2:45
but my requirement was to get
2:48
only the
2:51
fields that are
2:55
controlled and dependent
3:02
please check the video description in
3:04
the video description I have shared my
3:06
blog post from the blog post you should
3:08
be able to get the sample code sorry
3:10
example a circle which we referenced in
3:12
this video
3:24
I hope it was helpful
3:35
thank you for watching
#Internet Software