You need to sign in to do that
Don't have an account?
David Silva
How to get the custom setting values in the apex code.
Hi,
How to get the custom setting values in the apex code.
How to get the custom setting values in the apex code.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
You can query them like custom objects.
Ex. Suppose you have a custom setting named as 'Custom_Setting__c' .
So if you want it in your class then query it like [SELCT id, Name FROM Custom_Setting__c].
You can get custom setting value without using SOQL,
Suppose you have custom setting Games__c.
You can get the list of records through :
List<Games__c> mcs = Games__c.getall().values();
To get individual record 'My Games' of custom setting :
Games__c objGame = Games__c.getValues('My Games');
Hope it helps !!!
Regards,
Amritesh
For example, you have a custom setting for Country Code. It has 2 fields:
Name (object Name field same as when you create a custom object)
Code (Text field).
Visualforce Page
Controller
Please check the below links for more examples of custom settings.
http://blogatsalesforce.blogspot.sg/2015/03/use-custom-setting-efficiently-in-apex.html
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_custom_settings.htm
Best Regards,
Jyothsna
Let's assume we have some employee information stored in custom setting.
employee1 rollNo1
employee2 rollNo2
Syntax:
Employee__c obj=new Employee__c.getvalues('employee1');
String rolNo=obj.rollNo1__c;
For more detail visit,
https://www.sfdc-lightning.com/2018/09/custom-settings-in-salesforce.html