Requirement-I need to create a map of custom setting in apex class with fields and value like.

"Name":"test", "cal__c":"tesq", "industry__c":"manu"

how we can get custom setting fields in apex class.is this possible using schema

  • What is the type of your Custom Setting? Is it a List or Hierarchy? Nevertheless you can always access the Custom Settings records and then put the values on a map Aug 6, 2020 at 11:10

1 Answer 1


You need to use a describe call for custom settings.

If you have a custom setting named CustomSetting__c then use describe call which will return a map of all the fields :-

Set<String> flds = CustomSetting__c.sObjectType.getDescribe().fields.getMap().keySet();

It will return a set of Field names for the custom setting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.