We have some scenario where we need to skip validation and workflow rule to specific profiles.Since these set of profiles may change frequently (SYSADMIN can add/remove profile names to skip). To achieve this i have two options 1) Hierarchy custom setting 2) Custom permission

Out of this which one is the best approach ?

  • What do you mean by custom permission? How would you use that? – datmannz Nov 15 '16 at 10:30

Use Custom Setting it is the good solution. Create a flag in Custom Settings and then update the reference of that flag in your apex-trigger code.

So all you would do is create a new Hierarchical Custom Setting. Then for each trigger create a flag and perhaps a flag to disable all triggers.

Using the flag from custom setting add the if condition in apex-trigger code and run the trigger based on the flag.

  • i have modified the questions. Here we need to skip some logic NOT inactivating the trigger. – SUresh Shettigar Nov 15 '16 at 10:02
  • I think custom setting should work for skipping the logic as well based on the flag if you don't want to execute just put the if condition and it would work. – RCS Nov 15 '16 at 10:05
  • My question is which is the best approach based on any limitation/drawback ? – SUresh Shettigar Nov 15 '16 at 10:10

Use Custom Permissions instead of Custom Settings

Custom Settings having drawbacks... e.g. Custom Settings are data, they are not populated in unit tests unless the test specifically populates them


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.