0

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? – human Nov 15 '16 at 10:30
-1

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.

| improve this answer | |
  • 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
-2

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

https://unhandledsunshine.com/2018/12/06/use-custom-permissions-to-bypass-validation-rules-and-pass-unit-tests/

| improve this answer | |
  • I think this got flagged and closed because it doesn't necessarily address the question directly, or provide enough relevant detail. Link-only (or mostly link only) answers do get removed by the community pretty quickly. I've undeleted for now, so please do edit and add some more information if you can, otherwise it'll like just attract more down votes and/or be closed again. – Matt Lacey Dec 19 '19 at 1:34

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.