But, using some trick, we can make use of Custom Setting as a master switch. Custom Setting is mostly used by developer and not famous among Salesforce admin. I blog about custom setting sometime last year, read here.
Here is the step, let say we want to deactivate all Validation rule in Account:
1. Create Custom Setting
- Setup - Develop - Custom Settings
- Click 'New' button
- Enter Label 'Master Validation', Object Name, Description and select Setting Type = Hierarchy
- Save
2. Create Fields in Custom Settings
- Continue from step 1 above, in custom setting created
- Click 'New' button in Custom Fields related list
- Select Checkbox field type
- Enter field name and label 'Account Active'
- Enter Description and Help Text as necessary, Default Value does not really mattered.
3. Manage Custom Settings
- Click Manage button for that Custom Setting to set Default Organization Level Value
- You should see all fields available
- Click Edit button and make sure 'Account Active' is checked
- Save
4. Field Value for User or Profile (Optional)
You also can determine each user Profile value, users or profiles not added here will use Default Organization Level Value set in step 3 above.
- Click New in Manage Custom Setting
- Select user or profile in the lookup window
- Check active checkbox button
- Tips: if you just need to deactivate validation rule only to a profile, example: only for System Administrator when he load data using Data Loader, you just need to add 1 profile here to deactivate the value and let the rest of profiles Active via Default Organization Level Value.
5. Modify Validation Rule
Add following formula '$Setup.Master_Validation__c.Account_Active__c' in Error Condition Formula.
6. Done
Summary:
- Pro: Admin have full control to ON or OFF validation rule and workflow rule based on Object and Profile (or even User)
- Cons: Each existing validation rule and workflow rule need to modify and add additional formula into the formula.
No comments:
Post a Comment