web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Business Central Extension: Hiding fields based on Permissions sets

(0) ShareShare
ReportReport
Posted on by

This is the task:

  • Develop a business central extension that hides certain fields in the "Item Card" if the currently logged in user is NOT A SUPER USER


How do I accomplish this?  So far I have a page extension that hides the desired fields without the permission check.

Thanks

Categories:
  • Verified answer
    Community Member Profile Picture
    on at

    Hi Kenny,

    you can do it with a page extension and a simple filter on the Access Control table. Here is the code:

    pageextension 50110 ItemCardExtension extends "Item Card"
    {
        layout
        {
            modify("Unit Price")
            {
                Visible = isSuperUser;
            }
            modify("Unit Cost")
            {
                Visible = isSuperUser;
            }
            modify("Vendor No.")
            {
                Visible = isSuperUser;
            }
          // You Can add more fields with same structure
        }
    
        var
           isSuperUser : boolean;
    
        trigger OnOpenPage();
        var
           AccessControlRec :  Record "Access Control";
        begin
           isSuperUser := true;
            
           AccessControlRec.reset();
           AccessControlRec.setfilter("User Security ID",USERSECURITYID);
           AccessControlRec.setfilter("Role ID",'SUPER');
    
           If not AccessControlRec.findset() then
             isSuperUser := false; 
    
        end;
    }

    .

    Please verify my answer if you find my answer helpful. Doing so you'll show other community members that there was found a solution and you credit my help.

    .


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans