public List<String> getPickListValuesIntoList(string objectName, string field_apiname){
List<String> pickListValues = new List<String>();
try{
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Map<String, Schema.SObjectField> field_map = gd.get(objectName.toLowerCase()).getDescribe().fields.getMap();
List<Schema.PicklistEntry> picklistVal = field_map.get(field_apiname).getDescribe().getPickListValues();
for (Schema.PicklistEntry pv : picklistVal) {
pickListValues.add(pv.getValue());
}
}catch(exception ex){
system.debug('getPickListValuesIntoList : ' + ex.getMessage());
}
return pickListValues;
}
0 Comments