Close Menu
SalesforceCodex
    Facebook X (Twitter) Instagram
    Trending
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    • Top 10 PMD Issues Salesforce Developers Should Focus on in Apex
    • How to Use Graph API for Outlook-Salesforce Connection
    • Enhancing Performance with File Compression in Apex
    Facebook X (Twitter) Instagram
    SalesforceCodex
    Subscribe
    Tuesday, May 20
    • Home
    • Architecture
    • Salesforce
      • News
      • Apex
      • Integration
      • Books Testimonial
    • Questions
    • Certification
      • How to Prepare for Salesforce Integration Architect Exam
      • Certification Coupons
    • Integration Posts
    • Downloads
    • About Us
      • Privacy Policy
    SalesforceCodex
    Home»Salesforce»Field Access Explorer In lightning Web Component

    Field Access Explorer In lightning Web Component

    Dhanik Lal SahniBy Dhanik Lal SahniDecember 6, 2019Updated:June 11, 2023No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Field Access Explorer In lightning Web Component
    Share
    Facebook Twitter LinkedIn Pinterest Email

    In projects many time we need to check, user has access to read data or update data of any object’s field. We can check field access using UserFieldAccess object.

    In this post, i have create one lightning web component to show object and it’s fields in combox box.  Another combox box is added to show users in Salesforce Org. Based on input selected, it will show field access in lightning table.

    If only user and object is selected then it will show user access of all fields. If user, object and field name is selected then it will show access of specific field.

    To get field access below step need to follow

    1. Get DurableId from UserFieldAccess
    2. Get field access using above DurableId
    3. Showing access list in Lightning web component

    1. Get DurableId from UserFieldAccess:

    First we have to obtain the DurableId for fields. It is unique identifier for the field. We always have to check this field as it is changing in every release.

    List<UserFieldAccess> lists=[SELECT Durableid FROM UserFieldAccess
                                         WHERE FieldDefinition.EntityDefinition.QualifiedApiName=:objectName AND User.Id=:userId];

    2. Get field access using above DurableId

    Now retrieve user access detail using above retrieved Durableid.

    List<UserFieldAccess> accesses=[SELECT DurableId,EntityDefinitionId,FieldDefinition.QualifiedApiName,FieldDefinitionId,Id,IsAccessible,IsCreatable,IsUpdatable,UserId FROM UserFieldAccess 
    WHERE DurableId =:ids];

    Complete Apex code :

    3. Showing Field Access in Lightning  Table:

    We have field access list using above apex code now. Let us show that access list in lightning datatable. Let us create new LWC (Lightning Web Component) to show list.

    Below LWC component are used to show list

    1. combo box to show options
    2. lightning data table to show lis

    Complete LWC Code

    Demo Video:

    References:

    • https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_fielddefinition.htm
    • https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/example
    • https://developer.salesforce.com/docs/component-library/bundle/lightning:combobox/example

    Related Posts

    Salesforce DevOps for Developers: Enhancing Code Quality and Deployment Efficiency

    Apex Code Coverage In Custom Object

    Get All Used Custom Metadata Detail

    Find Referenced Metadata using Salesforce Dependency API

    Extract list of all fields from Page Layout

    Field Access Explorer In lightning Web Component

    apex field acess lightning Lightning web component
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleDependent PickList In Lightning Web Component
    Next Article Implement Factory Design Pattern In Salesforce Apex
    Dhanik Lal Sahni
    • Website

    Related Posts

    By Dhanik Lal Sahni6 Mins Read

    Top 10 Salesforce Flow Features of Salesforce Summer ’25

    May 11, 2025
    By Dhanik Lal Sahni6 Mins Read

    Unlock the Power of Vibe Coding in Salesforce

    April 30, 2025
    By Dhanik Lal Sahni5 Mins Read

    How to Implement Dynamic Queueable Chaining in Salesforce Apex

    April 21, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (110) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (29) Lightning web component (61) lwc (50) named credential (8) news (4) optimize apex (3) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (140) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    • How to Choose Between SOQL and SOSL Queries July 31, 2024
    Archives
    Categories
    Tags
    apex (110) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) code review tools (3) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (64) lightning-combobox (5) lightning-datatable (10) lightning component (29) Lightning web component (61) lwc (50) named credential (8) news (4) optimize apex (3) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (140) salesforce apex (46) salesforce api (4) salesforce api integration (5) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn Reddit Telegram
    © 2025 SalesforceCodex.com. Designed by Vagmine Cloud Solution.

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.