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
KartikeyKartikey 

Data Loader error

Hi All,

 

I have a validation on a date field (say  A)that depends an another field date field (say B).

 

Now whenever someone wants to select date in field A first it checks date field B and if the date in A falls in same week of date B, it allows.

 

for example. In date field B we have 13May. So that week would be 11th may 2009 to 17th May 2009 (Monday to Sunday)

 

then A can only accept dates from 11th may to 17th may.

 

We have called a method of a cls file in a trigger to make it work. But the same validation is called when we upload the data from dataloader. 

Is there a way to avoid the validation with dataloader.

 

workaround: I disable the peace of code from trigger which calls the validation.

 

Appreciate any help.

aalbertaalbert

I have to ask the obvious question - why don't you want to enforce that validation rule in the API as well?

 

If you do want to disable it, you could disable it by Profile Names. For example, if System Admin, suppress validation logic. 

 

BritishBoyinDCBritishBoyinDC
Or create a flag on the record called 'Ignore Validation' that defaults to false and that only sys admin can see/update, and update the trigger to only fire when the flag is set to false. For data loads that don't require validation, set the flag in the load file to true
KartikeyKartikey

Thanks for your reply..

The users of the application are sales reps. They create the opportunities and close it when needed. They also export and import the data from it. So I cant disable it by checking the profile names (I believe).

If there is a way I can check in the code itself whether the call is from DataLoader or not. Coz I dont want a peace of code to execute when its coming from DataLoader.

Please suggest.

 

KartikeyKartikey

Appreciate your suggestion BritishBoyinDC!!

I have more then 500 users who are using the application all over the world. If I create a flag to control the close data field, they have to request me to disable the flag for every import.

Thanks again..