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
Antonio Jesús Criado ManzanequeAntonio Jesús Criado Manzaneque 

How to get the picklistEntries from a field filtered (with another controlling field)

My object Case has two picklist fields:
  • Entidad__c with three possible values: Customer, Reservation and Program.
  • Tipo__c with six possible values: Customer A, Customer B, Reservation A, Reservation B, Program A and Program B. This field depends on Entidad__c value.
I am getting both field values in my Controller but I want to get Tipo__c values filtered by Entidad__c.
Schema.DescribeFieldResult fieldResult = Case.Tipo__c.getDescribe();
List<Schema.PicklistEntry> plv = fieldResult.getPicklistValues();
		
for( Schema.PicklistEntry f : plv){
      system.debug(f.getLabel() + ' - ' + f.getValue());
}
This code give me all the values, regardless of the value of field type__c. How can I get its values filtered?

Thank you all.