You need to sign in to do that
Don't have an account?
SFDC Developer1
Apex describe picklist values
I have one custom object abc__c which has one text field number__c and i have another object temp__c which have one picklist field.
I want to check if the value of number__c field from first object present in temp__c picklist field of second object.
I am using getDescribe() but I am not able to do the comparison.
If the value is present, I want to perform few actions and if not present then I want to perform another action. Kindly help as i am new to the development.
I want to check if the value of number__c field from first object present in temp__c picklist field of second object.
I am using getDescribe() but I am not able to do the comparison.
If the value is present, I want to perform few actions and if not present then I want to perform another action. Kindly help as i am new to the development.
abc__c obj = new abc__c (number__c ='Test');
temp__c tmp = new temp__c ();
//tmp.Country= 'Testing';//Picklist Value
temp__c .fields.Country.getDescribe().getpicklistvalues();
The above will return you all the possible picklist values. You can loop through the values or use a map to "search" it.
This functionality is called dynamic Apex!
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
I should i compare value of my text fields with pickListVal?