How can we disable triggers, Validation Rules and workflow rules in salesforce org. [on off – switch]

How can we disable triggers, Validation Rules and workflow rules in salesforce org.

This becomes really needed and important when we are doing data migration(data imports) in salesforce.

The way I handled this is create a custom label and include it in workflow and validation rule logic.

example – Custom label ‘Disable workflow’ = True then do not fire workflows.
if its False then fire workflow

But wanted to understand if there is any more efficient way to handle these scenarios.

Answer

Custom settings are available from both Workflows and Triggers. If you create a “Hierarchy” custom setting object with a checkbox you can reference that checkbox to enable/disable the validation or code. The hierarchy design would allow you to set system wide defaults and then override individual users as needed. Its been pretty effective in a number of occasions.

Attribution
Source : Link , Question Author : Prafulla Patil , Answer Author : ebt

Leave a Comment