@@ -86,6 +86,26 @@ public class RemoteTKController {
8686 return null ;
8787 }
8888
89+ private static List <Object > picklistOptions (Schema.DescribeFieldResult field ) {
90+ List <Object > picklistOptions = new List <Object >();
91+ Schema .DisplayType fieldType = field .getType ();
92+ if (fieldType != Schema .DisplayType .Picklist &&
93+ fieldType != Schema .DisplayType .MultiPicklist &&
94+ fieldType != Schema .DisplayType .Combobox ) {
95+ return picklistOptions ;
96+ }
97+ List <Schema .PicklistEntry > picklistValues = field .getPicklistValues ();
98+ for (Schema .PicklistEntry picklistValue : picklistValues ) {
99+ Map <String , Object > picklistOption = new Map <String , Object >();
100+ picklistOption .put (' value' , picklistValue .getValue ());
101+ picklistOption .put (' label' , picklistValue .getValue ());
102+ picklistOption .put (' active' , picklistValue .isActive ());
103+ picklistOption .put (' defaultValue' , picklistValue .isDefaultValue ());
104+ picklistOptions .add (picklistOption );
105+ }
106+ return picklistOptions ;
107+ }
108+
89109 @remoteAction
90110 public static String describe (String objtype ) {
91111 // Just enough to make the sample app work!
@@ -113,7 +133,8 @@ public class RemoteTKController {
113133 if (! references .isEmpty ()) {
114134 field .put (' referenceTo' , references );
115135 }
116-
136+ field .put (' picklistValues' , picklistOptions (descField ));
137+
117138 fields .add (field );
118139 }
119140
0 commit comments