You need to sign in to do that
Don't have an account?
Vablet Developer
Apex dependent picklist
The solution all over the web, http://titancronus.com/blog/2014/05/01/salesforce-acquiring-dependent-picklists-in-apex/ does not work in all cases it seems.
Is there an official solution yet, or maybe an alternative? That code above is the only one that seems to be floating around on different sites.
Is there an official solution yet, or maybe an alternative? That code above is the only one that seems to be floating around on different sites.
Please see the below code
Best Regards
Naga Kiran
I understood your probelm ,Please try with below code it will work perfectly.however you need to do one thing each controlling field should have atleast one dependent field .
The map in code will return you the key as controlling field and vaue will be the list of dependent field .
Let m eknow any issue .
Thanks
Manoj
Above code is working for me . Can you please tell me the issue what exactly you are facing ?
Thanks
Manoj
When either code is used, the map returned says that there are NO items for that selected option. This is incorrect according to the Salesforce one application.
Now many of the items work, but not ALL of them and that is the issue.
You've saved my day.
Thanks!
Can you post the pick list values for which code is not working ,I think we have to modify littele bit in code to make it functional .
Please let us know your problem .
Thanks
Mnaoj
ing field ,It is not coming into dependen
Still I am not able to understand your problem .Please explain your problem clearly .So that I will help you .
If have atleast one dependent pick list for each controlling field then it will work for sure .
For smaller picklists where i have 5-6 picklist values it is working fine...But when i have 240 values in controlling field and around 340 values in dependent picklist it doesn't works properly. In the map i am getting the keys values properly i.e have 240 value... but i m getting repeated dependent values in many of the controlling field. Like i am getting value1 in key1 and key2 and many other values getting repeated in the other keys. And can you share anything related to test classes for it.
Note: Not all my controlling fields have dependent pikclist values.
I have implemented the same code you have written .But every i am getting all value of the dependent picklist .
Like for controlling value "ABC" is Dependent on Dependent Value "ABC".
So its should Show on ABC.
Instead of this its showing all the value of Dependent picklist.
The blog post also includes an explanation of the problem, a breakdown of how the code works, and test code that provides 100% coverage with assertions.
I hope someone finds it useful!
Hi Manojjena,
I have implemented your code and its working perfect,
Thanks