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
Ravi Chandra 64Ravi Chandra 64 

Validation Rules would work during the data loader process ?

Apoorv Saxena 4Apoorv Saxena 4

Hi Ravi,

Yes, validation rules work while importing data through data loader.

Dataloader creates a success and  an error file and if you have a validation rule that causes dml operation to fail, dataloader creates a column in error file giving a brief description of the error.

If you do not want validation rule to fire while importing data through dataloader, you'll have to deactivate the validation rule and then import the records using data loader and then again activate your validation rule. 

Please mark this question as solved if this helps you so that other users can view it as a proper solution.


Ravi Chandra 64Ravi Chandra 64
Hello Apoorv,

But it is not a good practise to deactivate the validation rule bocz in that gap someone can enter bad data..!!

Help me if i'm wrong.

Thank you
Hi Ravi,

Yes; you are correct in stating that it is not a good practise to deactivate validation rules because the time during which it sits inactive, you can have bad data entered which would have a negative downstream effect to your business processes.

What you could do, however, is to put an exclusion in your validation rule in either ways:
  1. You hardcode the SFDC User ID you will be using to perform the data load in the Validation Rule(s) as an exclusion. Or,
  2. You create a field on the User record named "Bypass Validation" and set it to True for the User record which you will be using to perform the data load. Now put an exclusion in the Validation Rule to not fire if this newly created Flag's value on the Current User is set as True. Once the data load is complete, just set the flag to False.

Both these approaches will work but the second approach is a more long term sustainable path going forward. I am not sure how complex your SFDC org is but as it grows and as you start using Apex Triggers and Batch jobs, such exclusions play a crucial role in Application Management.

If you are interested you might want to read up on the concepts of PAD or Parallel Application Development.

I hope this helps; do let me know how it works out for you.

Kind Regards,

Apoorv Saxena 4Apoorv Saxena 4

Hi Ravi,


Yes, you are absolutely right in thinking that it is not a good practise to deactivate the validation rules when importing data and again activate them once importing is done.

So, here is a trick that you can use to bypass validation rules when importing data through data loader :

You need to modify your validation rule and make it user specific like :

Suppose you have a user with an alias as Ravi, so you could specify your validation criteria like:

AND( $User.Alias <> "Ravi_bypass", [ Your Validation Rule Criteria Here])

Now the trick here is that when you want to import data through dataloader and bypass the validation rule, so you can easily go to the User record and update the alias name from 'Ravi' to 'Ravi_bypass', that ways your validation rule wont fire as the condition won't be true(as validation rules throw error message when condition is true)

So now you can easily import data and once you are done , you can go back to the user record and again update the user alias back to 'Ravi'.

Just to make it clear for you:

When you need to perform data import and bypass the validation rule, just update the user alias to 'Ravi_bypass'.
Once you're done with importing update user alias back to 'Ravi'.

Hope this helps!

Please let me know if you still need some more details.


Sunil Shah 12Sunil Shah 12
Thanks Apoorv, I had a similar query :)