Custom settings: How to get the data
SO_Country__c code = ISO_Country__c.getInstance('name_of_the_custom_settings'); //To return a map of data sets defined for the custom object (all records in the custom object), //you would use: Map<String,ISO_Country__c> mapCodes = ISO_Country__c.getAll(); // display the ISO code for India System.debug("˜ISO Code: "˜+mapCodes.get('name_of_the_custom_settings').ISO_Code__c); //Alternatively you can return the map as a list: List<String> listCodes = ISO_Country__c.getAll().values();
How to get all the required fields of sObject dynamically enum in APEX