function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amitkumar15Amitkumar15 

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.

Avidev9Avidev9

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