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?

2 Answers 2


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, 1/1/2014.

Inside your validation rule, you'll be able to write something like the following:

$Setup.DateCustomSetting__c.Editable_Date__c >= CreatedDate

  • Doesn't this require to modify all the validation rules? I think the question is about if it is possible to avoid modification of every validation rule
    – Patlatus
    Commented Jun 1, 2016 at 14:39
  • To add a custom setting to each validation rule, you will have to edit each rule regardless to make the changes. Once the setting is in place, any further changes to the dates used (Such as changing the year from 2014 to 2015), will only require modifying the custom setting, and not each validation rule individually. Commented Jun 1, 2016 at 14:44
  • 2
    This is definitely the best way to go imo. $Label seems very brittle since you can't take advantage of strict typing.
    – Adrian Larson
    Commented Jun 1, 2016 at 16:22
  • I am sorry, I may have expressed myself a bit unclear. I don't want to add a date value into each validation rule, because then I would have to update each validation rule again, if I wanted to change the date. So custom setting is the way to go I think. I can add that to each validation rule once and then that's it
    – Lily
    Commented Jun 1, 2016 at 18:59
  • I have tried this now. I created a custom setting and a Date/Time field in the custom setting. As a default value in the date/time field I wrote: 2014-01-01 00:00:01. I get the error message: Error: Syntax error. Extra '00' When I remove the time part from the date/time value, I get: Error: Formula result is data type (Number), incompatible with expected data type (Date/Time). what am I doing wrong?
    – Lily
    Commented Jun 1, 2016 at 19:04

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.

  • Hello ,thats a great idea. I have created a custom label, however I get an error message now: Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date. This is strange, because I have actually put a datetime value into the custom label: 2014-01-01 00:01:01
    – Lily
    Commented Jun 1, 2016 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .