0

I just need to confirm your experienced, if there is something I need to be aware of in using Custom Permission?

We are hesitant to used the custom permission assigned to permission set to create exceptions. Currently, I am not getting any news that there are any disadvantages. Is there any? Would it be better to write an apex code that prevent the permission set user in selecting the status rather than creating a validation rule using the custom permission? Would appreciate your response.

3
  • Welcome to SFSE Community!!!. As per my knowledge.. there is nothing wrong in using custom permission in Validation rules, If you're logic is very simple. Or is it having any complex then please use Apex to complete that. It's a best practice in SFDC to goes as LOW CODE >> PARTIAL CODE >> PRO CODE/FULL CODE. for all time
    – Raj
    Dec 21, 2023 at 10:46
  • in your case Custom Permissions is even a preferred way to go Dec 21, 2023 at 11:14
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Dec 21, 2023 at 17:24

1 Answer 1

0

First principles:

  • Validation Rules exist to keep the database in a consistent state. That is, they prevent invalid values, enforce cross-field consistency and more

Your premise is that you want to bypass some validations for users possessing a custom permission. Assuming you have a really good reason for doing this (for example, only Sales Operations can change the close date of a closed-won Opportunity), then

  • Using Custom Permissions in the VR is an excellent way to go
  • It is transparent to admins who inspect the VRs
  • It is consistent with SFDC approach to using Permission Sets to control access

Using Apex to inspect for the presence of custom permissions (FeatureManagement class), while certainly doable, introduces coding and unit testing obligations. If you already have an Apex-heavy implementation that is doing Apex-based validations, then it might be easier to manage if all such permissions-based validations were in one place (i.e. Apex)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .