Custom Permissions provide a simple and flexible way to control access to Lightning Web Components (LWCs) without modifying profiles or creating multiple Lightning pages. By combining a Custom Permission with Dynamic Component Visibility in Lightning App Builder, you can ensure that a component is displayed only to users who have the required permission.


This article explains how to create a Custom Permission, assign it to users through a Permission Set, and configure a Lightning record page so that the Lightning Web Component is visible only to authorized users.


Details given below


1. Create the Custom Permission

Go to:

Setup → Custom Permissions → New

Example:

  • Label: View Time Tracker Component
  • API Name: View_Time_Tracker_Component


2. Assign it through a Permission Set

Create or open a Permission Set, then go to:

Custom Permissions → Edit

Add View Time Tracker Component, save it, and assign the Permission Set to the required users.


3. Configure component visibility

Open the Lightning page in Lightning App Builder:

  1. Select the LWC.
  2. Open Set Component Visibility.
  3. Click Add Filter.
  4. Select Permissions → Custom Permission.
  5. Choose View Time Tracker Component.
  6. Set the value to True.
  7. Save and activate the page.