Created
February 19, 2018 18:14
-
-
Save msrivastav13/311031d05639df8f9e6796982c2d5190 to your computer and use it in GitHub Desktop.
Gets the Field Picklist labels and values from the Object Metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CommunityBuilderPickListUtil extends VisualEditor.DynamicPickList{ | |
global override VisualEditor.DataRow getDefaultValue(){ | |
VisualEditor.DataRow defaultValue = new VisualEditor.DataRow('Product Family', 'Product Family'); | |
return defaultValue; | |
} | |
global override VisualEditor.DynamicPickListRows getValues() { | |
VisualEditor.DynamicPickListRows myValues = new VisualEditor.DynamicPickListRows(); | |
Schema.DescribeFieldResult fieldResult = Product2.Family.getDescribe(); | |
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); | |
for( Schema.PicklistEntry f : ple){ | |
VisualEditor.DataRow value = new VisualEditor.DataRow(f.getLabel(),f.getValue()); | |
myValues.addRow(value); | |
} | |
return myValues; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<design:component> | |
<design:attribute name="property1" datasource="apex://CommunityBuilderPickListUtil"/> | |
</design:component> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment