You need to sign in to do that
Don't have an account?
khillan bhardwaj
Count the all available picklist value in the multiselect picklist of an Object
Dear Sir ,
i want to calculate no. of the picklist values avaiable in the multiselect picklist of the Object and i want to show that counted value in the vf page
thanks u
Khillan,
Something like this:
Schema.DescribeFieldResult fieldResult;
fieldResult = My_Object__c.My_field1__c.getDescribe();
List<Schema.PicklistEntry> picklistVals= fieldResult.getPicklistValues();
Integer listSize = picklistVals.size();
Best,
Ram
All Answers
Khillan,
Something like this:
Schema.DescribeFieldResult fieldResult;
fieldResult = My_Object__c.My_field1__c.getDescribe();
List<Schema.PicklistEntry> picklistVals= fieldResult.getPicklistValues();
Integer listSize = picklistVals.size();
Best,
Ram
Hi,
Try this
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
public SObjectType sot = gd.get(selectedObject);
DescribeFieldResult dfr = sot.getDescribe().fields.getMap().get(pklstName).getDescribe();
List<PicklistEntry> entries = dfr.getPicklistValues();
Integer sizeOfPkValues = entries.size();
You can use this "sizeOfPkValues" in vf page.
If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.
Thanks
yes sir this is work for get my objective