Monday, 27 January 2014

Difference between Custom Settings and Custom Objects



1)
Custom Settings is nothing but Cache i.e. If you want to use the records in that table no need to write any queries. If there a common static data across the Org then you can use Custom Settings.
Ex:
Map<String_dataset_name, CustomSettingName__c> mcs = CustomSettingName__c.getAll();
CustomSettingName__c mc = CustomSettingName__c.getValues(data_set_name);
If you want to access the data from Custom object then you have to write the queries.

2)
Custom object is  a record table and Custom setting is a configurations table. Custom object is like any Database table that we used to have in SQL or in any other database.
CustomSetting is like configuration file that we used to have. Even though List type of custom setting looks like that it is also a custom object but there are differences. LIke in custom settings there is a limit on no of records, you can not write trigger, workflow etc on custom setting.

3)
A custom setting is very similar to a custom object, the main difference is that the custom setting is cached.
It is especially useful to store information that will be often accessed from Apex code as it will perform better than a custom object as it doesn't have to be queried, it is also easier to manage it.

No comments:

Post a Comment