Getting value from Custom Setting

I figured out how to getting value from custom setting. I know, I am too slow! :) .

The purpose of custom setting can be read here.But my purpose is to store the Application configuration such as Key.In java , maybe I will store

I create Custom Setting with details value:

Label : Application Config
Object Name: Application_Config__c 
Setting Type : List  [Please go to here for more knowledge on List/Hierarchy differences]
Visibility:Protected [I choose it by default]

Once created, you will able to create custom fields.Last time I tried to create Name field without realize Name is default field.

For this , I create one field named Value with API name Value__c .

I inserted the data with Name : App_Name and Value__c : Health Monitoring .

I just test in Apex Execute :

String str1=Application_Config__c.getValues('App_Name').Value__c;
system.debug('unid -'+str1);

So that is how we can call custom setting value.



Popular Posts