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
Ivan@LMIvan@LM 

Disable validation rules, filters, triggers in Apex way.

Hi, Experts - I am using data loader; however when importing I quickly found out there validation, trigger, filters in my way to mass import records. Without manual steps, how can I disable all these in pre-load and enable them again post-load programically. Some snippets /KBs will help as I am very new to sforce, thank you.
Ritesh AswaneyRitesh Aswaney

I dont reckon there is  a straightforward way of doing this, as if you intend to do this programatically, it will mean deployment of the metadata with Active set to false for all your triggers and / or validation rules.

 

Usually, Validation Rules and / or triggers have a skip block, where the executing user is checked and if one of those in a list, then exeuction of the logic is skipped. THis is handy for such data load operations.

 

Just a note of caution however, validation rules (and some triggers) are usually for data quality and/or integriy, therefore while disabling them might be convenient, it may not be entirely desirable.