function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Preya VaishnaviPreya Vaishnavi 

Checking whether a dependent field has a value from the controlling field

Hi all,


There are 3 dependent fields test1,test2,test3,


test3 is dependent upon test2

test2 is dependent upon test1


test3 may or may not have a value...


Now i need to check in my apex class...whether test3 has any value for a particular value of test2


for eg: test2='value1' for this value of test2....test3 does not have any value... I need to check this without seeing the value of test3...


Is it possible...?


Thanks Much!!!!!!!!!!!!!




I think you cannot check the dependency in apex class. If you are using the <apex:inputfield> then dependency on the page will display otherwise you have to a custom logic in your controller.



Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Preya VaishnaviPreya Vaishnavi



Can u say wat may be the check if the dependent field does not have a value based on the controlling field?



Tejpal KumawatTejpal Kumawat


Get All the test2 and test3 records Using inner SOQL Query for test2='value1'


And try to Use it..



If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.





Hardcord the values i belive that the only soluction

I am still looking in u r problem i will let u know as soon as i get anything

Preya VaishnaviPreya Vaishnavi



Yeah!!! Temporary solution is hardcoding...


Querying will not yield all the results.It will only fetch the records that is already saved in the database....


Does salesforce has any method to get the relationship between controlling and dependent field?