function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tulasiram chtulasiram ch 

how to use custom Settings in Triggers

I was stored a list of numbers in customSettings__c
i have a "Enter_Number__c " field on Object__c.
Then if a user enter any value already existed in the customSettings__c, it will throw an error. 
How can we do that.
1.Using Trigger
2.Using Validations.   please help me out.
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Tulasiram,

You can use custom settings in Apex triggers - the fact that you are in a trigger doesn't make any difference, you can use the mechanism for accessing via Apex:
 
The docs have details of this and some sample code:
 
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm

Please mark it as best answer if the information is informative.

Best Regards
Rahul Kumar