Pages

Tuesday, September 8, 2015

Salesforce: Custom Setting Deployment

Almost 2 years ago, we discussed about Custom Setting introduction in this blog. Today, we are going to discuss on how to deploy Custom Setting from an organization or other organization.

As admin, you can use Change Set to deploy Custom Setting, all Custom Fields within particular Custom Setting will be deployed into new org. However, all data in the Custom Setting will be not copied in the target org.


When you have only 2 or 3 data in custom setting, manually re-create the data in target org is not an issue, but when you have 20 or 50 or even more, manually re-create the data is not efficient and prone to error.

Fortunately, Salesforce allow us to query the Custom Setting, export and insert them just as you do with a Standard or Custom Object. Once the Change Set deployed, the Custom Settings and the Custom Fields are created in the target org, then use Data Loader to export the data from source org and insert into target org.

In this example, I have a Custom Setting called Country (the API name will be similar with custom object with suffix __c).


With developer workbench, we can see Custom Setting similar with object with customSetting attribute = true.


Compare to custom object below, where customSetting attribute = false.



Query Custom Setting: SELECT Id,Name,Country_Name__c,Country_Code__c FROM Country__c


The same values show in Custom Setting List View:




ReferenceSalesforce Custom Setting