How To Use Custom Permissions In Salesforce Flow

Custom Permissions in Salesforce are a powerful feature used to control access to specific functionality or features within your Salesforce Org for Validation Rules, Flows, and Apex code. They provide a flexible way to manage user permissions beyond the standard object or field-level security. You can use them as a switch or toggle to control your automation.

Key Features of Custom Permissions

  1. Granular Control: Custom Permissions allow you to define access to specific app features or processes without relying solely on profiles or permission sets.
  2. Dynamic Use Cases: They can be used to switch access on and off for custom functionality like buttons, Visualforce pages, Lightning components, or Apex code.
  3. Hierarchical Configuration: You can assign custom permissions through permission sets or profiles, giving flexibility in managing user access across different roles.

Common Use Cases

  1. Feature Activation: Control whether a user can access specific features in an app.
  2. Process Visibility: Show or hide parts of a process, such as a button or field, based on whether a user has the associated custom permission.
  3. Conditional Logic: Use in Apex, Validation Rules, or Flows to conditionally execute logic based on whether the current user has the custom permission.

Benefits of Salesforce Custom Permissions

  • Modularity: Decouples feature access from broader permissions, simplifying configuration.
  • Efficiency: Simplifies permission management when features are tied to multiple user roles.
  • Reusability: Enables scalable access control that can adapt as your organization grows.
🚨 Use case 👇🏼

Your organization adheres to a strict release schedule, requiring the deployment of a record-triggered flow today. However, activation of this flow should occur in one week without your direct involvement.

Solution: Create a custom permission and assign it to a permission set. Assign the permission set to all users. Add to the entry criteria for your record-triggered flow that the running user must not have the custom permission for the flow to execute.

Here is how it is done:

Creating and Using Custom Permissions

  1. Create Custom Permission
  • Go to Setup > Custom Permissions > New.
  • Define the name and description for the custom permission.

Custom Permission in a Permission Set

  1. Assign to Users
  • Add the custom permission to a Permission Set (or Profile).
  • Assign the permission set to all users. Remember that you can assign permission to only a few users or groups (granular control) if your use case calls for it. Define an expiration for the assignment: the permission set must be scheduled to be removed in a week.

Permission Set Assignment With Expiration

Build your flow

  1. Build a record-triggered flow. For example, a flow that sends out an email.
  2. Add to your start element criteria (Remember this will be true when the custom permission is not present.                       The toggle will be on.): NOT({!$Permission.CustomPermissionName})
  3. Test, debug, and deploy your flow. Make sure it is active.

Flow Entry Criteria With Custom Permisison

By using Custom Permissions, you can assign granular feature access and enhance security while maintaining flexibility.

Other Use Cases for Custom Permissions:

  • Validation Rules: NOT($Permission.CustomPermissionName)
  • Apex Code: FeatureManagement.checkPermission(‘CustomPermissionName’)
  • Lightning Components or Buttons: Conditionally display based on user access.

Conclusion

Custom permissions in Salesforce offer a versatile solution for managing complex access controls within your org. By enabling granular, dynamic, and hierarchical access management, they allow you to fine-tune how features and functionalities are deployed and utilized across different user roles. Whether you’re looking to activate specific features, manage process visibility, or implement conditional logic in your applications, custom permissions provide the flexibility and scalability needed to address these requirements effectively. As demonstrated with the record-triggered flow use case, integrating custom permissions into your Salesforce setup not only enhances security but also ensures operational efficiency and adaptability to evolving business needs. By utilizing this feature, Salesforce admins and developers can ensure that their org’s environment remains both secure and precisely tailored to their specific operational demands.

Explore related content:

Using Custom Metadata Types in Flows Without Get

How to Use Custom Metadata Types in Flow

15 Effective Salesforce Flow Debug Strategies

Flow Naming Convention Tips

Profiles and Permissions in Salesforce: The Simple Guide for Admins

Andy Engin Utkan

Andy Engin Utkan is a Salesforce MVP with 24 certifications. He is the founder of Salesforce Consulting Partner BRDPro Consulting. Utkan is a consultant, trainer, and content creator, focusing on automating business processes using Salesforce flow. He is recognized for his expertise in Salesforce flow, providing guidance through various courses and contributing actively to the Salesforce community.
Back to top button

Discover more from Salesforce Break

Subscribe now to keep reading and get access to the full archive.

Continue reading