I have a number of validation rules on Accounts, and now I want to exclude all accounts that have been created before 2014. Instead of entering the date criteria into every validation rule, I was wondering whether it is somehow possible doing this using a custom setting? Like that I can refer to the custom setting in the validation rules, and if I need to make changes to the date, I only have to do it in one place. Any ideas how I can do that?
If you create a Custom Setting of a Hierarchy type, you'll be able to access this setting inside validation rules. List Custom Settings are not usable inside validation rules, however. Add a field to the setting of a DateTime or Date type, say
Editable_Date__c, and then set a Default Organization Level Value, to say,
Inside your validation rule, you'll be able to write something like the following:
$Setup.DateCustomSetting__c.Editable_Date__c >= CreatedDate
Just a quick idea (haven't tested it yet).
You could try and save the date in a Custom Label (Creating Custom Labels) and refer to that label in your validation rule:
This will obviously be text, so you will need DATEVALUE() formula to parse it to a date format your validation rule will understand, see Documentation on DateValue formula.
So, let's say you created your label called
ValidationDate and filled it with "2014-06-01", then you could try the following validation rule:
CreatedDate < DATEVALUE($Label.ValidationDate)
Just expand this formula to your requirements.