Custom settings are genereally used to store Application level master or settings data. In case you need to insert the data manually, navigate to Setup > Custom Settings > Your Custom Setting Object Name > Manage > New. You can then add the data for the fields available on the Custom Setting.
In case you intend to do this programmatically via Apex, you can use the regular DML methods to create the record. Assuming that your Custom Setting API Name is Country__c, which has 2 fields Country Name (CountryName__c) and Country Code (CountryCode__c) then the Apex code to create Custom Setting records would be as follows
public class CountryService{
//Constructor
public CountryService(){
this.insertCountries();
}
private List<Country__c> insertCountries(){
List<Country__c> countryList = new List<Country__c>();
countryList.add(new Country__c(CountryName__c = 'India', CountryCode__c = 'IN'));
countryList.add(new Country__c(CountryName__c = 'Japan', CountryCode__c = 'JPN'));
countryList.add(new Country__c(CountryName__c = 'United States of America', CountryCode__c = 'US'));
countryList.add(new Country__c(CountryName__c = 'China', CountryCode__c = 'CHN'));
if(!countryList.isEmpty()){
insert(countryList);
}
}
}
Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it help you resolves your issue.
In case you intend to do this programmatically via Apex, you can use the regular DML methods to create the record. Assuming that your Custom Setting API Name is Country__c, which has 2 fields Country Name (CountryName__c) and Country Code (CountryCode__c) then the Apex code to create Custom Setting records would be as follows Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it help you resolves your issue.
- Setup
- Custom Settings
- Your Custom Setting Object Name
- Manage
- New
Let us know if this will help you