Referencing Custom Permissions on Validation Rules causes the execution time to be higher than expected
Last updated 2016-12-08 ·Reference W-2897882 ·Reported By 9 users
Validation rules that use the $Permission formula run longer than rules that do not include custom permissions or that use Custom Settings.
Validation Rules - Custom Settings (fast)
1- Create 4 validation rules on Opportunities and use the following formula (or whatever fits your environment)
2- Open the Developer Console
3- Create or edit an opportunity. You will see the 4 errors.
4- Go to the developer console and click the Logs tab at the bottom. Double click the latest log.
5- Click Debug at the top of the screen > Switch Perspective > Analysis
6- Click on the Timeline tab of the Execution Overview. You will be able to see how much time was spent on Validation rules.
This can run for about 1.85 ms
Validation Rules - Custom Permissions (slow)
1- Edit the validation rules we created earlier and use the following formula - This uses the custom permission
2- Follow the same steps as earlier (edit an existing opportunity and open the Timeline view in the dev console).
The time spent is about 117.35 ms. A hundred times more than when using Custom Settings.
Use Custom Settings instead of Custom Permissions.
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.