Wednesday, January 22, 2014

What is the custom settings

What is the custom settings

Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, Apex, and the Web services API.
Ex:
private static map<string, map<string, test_CS__c>> internal_storage;

        private static void populateInternalStorage(){
               internal_storage = new map<string,map<string,test_CS__c>>();
               Map<string, test_CS__c> allRecords = test_CS__c.getAll(); //get everything from the SFCD cache
               for(test_CS__c tcs:allRecords.values()){
                     if(! internal_storage.containsKey(tcs.subIdentifier1__c)){
                             internal_storage.put(tcs.subIdentifier1__c,new map<string,test_CS__c>());
                       }
                     internal_storage.get(tcs.subIdentifier1__c).put(tcs.subIdentifier2__c,tcs);
                 }
        } 

No comments:

Post a Comment