In a traditional database, constraints will be applied to all data in the database. In Salesforce, however, validation rules only apply to data that has changed. As I update my schema, I also update the data to keep it in line with the new schema so that it is still relevant. Sometimes this triggers a validation error in the record, whether it's due to data I've changed or (more often) old data that hasn't changed at all.

What I've done to move forward is either:

  1. Most often, I fix what I can and throw what I can't back to the user to fix.
  2. When pressed, I turn off the validation rule and feel dirty.

Is there a better way to update legacy data?

2 Answers 2


What I've done in the pass is to modify the validation rule to be after certain record creation date. Example lets say I just implemented this rule as of today, Jan 6 2015. However if anyone tries to edit records created before then, ie Dec 30 2014, this rule would fire. Add as part of the rule that the record created date has to be greater than Jan 6 2015.

The other thing I've done is to put the Bypass Validation rule on any rules which fire when I'm doing bulk updates or working in the system. You can read about this here; Blog post about custom setting

  • But this makes reporting on all the data together incredibly onerous and hard to maintain. Mar 24, 2015 at 3:07

In your validation rule you can add this line

 (your validation error formula) && CreatedDate > DATE(2013,07,05)  

where CreatedDate is a standard field and validation rule will fire only for the records that are created after the date you want. (In this example I have used 5 July 2013 ) . So this formula will hold true only for records that satisfy the validation criteria and that are created after the specified date and will give error. Hope this helps :)

You must log in to answer this question.

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