+ 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:

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

Best Regards
Rahul Kumar