+ Start a Discussion

Custom setting Issue


is it possible to get all fields(only) from custom setting??

Devender MDevender M
Hi you can get it by field describes.

String sfields= '';
Map<String, Schema.SObjectField> objectFieldMap = Schema.getGlobalDescribe().get('CustomSettingAPI').getDescribe().fields.getMap();
for(Schema.SObjectField column: objectFieldMap.values()) {
sQuery += column+', ';
system.debug(sfields); // here u can see all fields.


You can use global describe for this purpose


Map<String, Schema.SObjectField> M = Schema.SObjectType.CustomSetting__c.fields.getMap();

 This will return you map of FieldAPI and SObject Field. This works for any custom object and as well as on Custom Settings.


For Further detail have a look here http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm