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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Page Customization for Profiles.

(1) ShareShare
ReportReport
Posted on by 44
Hello,
 
MY object:
To Hide the' Document Sending Profile' field on the Customer Card (Page 21) only for users with the profile ID 'Inventory Manager'.
 
I am using the Following Code in VS code. The code is showing no errors but its not effective. when i logged in as an 'Inventory Manager' i still can see that field.
Can someone kindly help me out on this.
 
I am using the following code:
pageextension 50100 HideDSPField extends "Customer Card"
{
    layout
    {
        modify("Document Sending Profile")
        {
            Visible = ShowField;
        }
    }
 
    var
        ShowField: Boolean;
 
    trigger OnOpenPage()
    var
        UserPersonalization: Record "User Personalization";
    begin
        // Default to visible
        ShowField := true;
 
        // Check current user's profile
        if UserPersonalization.Get(UserId) then
            if UserPersonalization."Profile ID" = 'Inventory Manager' then
                ShowField := false; // Hide for Inventory Manager
    end;
}
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,150 Super User 2025 Season 2 on at
    You should use the OnAfterGetCurrRecord() trigger instead, which does run before layout evaluation:
     
    pageextension 50100 HideDSPField extends "Customer Card"
    {
        layout
        {
            modify("Document Sending Profile")
            {
                Visible = ShowField;
            }
        }
    
        trigger OnAfterGetCurrRecord()
        var
            UserPersonalization: Record "User Personalization";
        begin
            ShowField := true; // default to visible
    
            if UserPersonalization.Get(UserId) then
                if UserPersonalization."Profile ID" = 'Inventory Manager' then
                    ShowField := false; // hide for Inventory Manager
        end;
    
        var
            ShowField: Boolean;
    }
    
     
     
    Mark this as the verified answer if it helps.
  • Suggested answer
    RockwithNav Profile Picture
    8,637 Super User 2025 Season 2 on at
    I don't have a Sandbox running to publish it but please see if this is working 
     
     
    //RWN
    pageextension 50100 HideDocumentSending extends "Customer Card"
    {
        layout
        {
            modify("Document Sending Profile")
            {
                Visible = not IsInventoryProfile;
            }
        }
        var
            IsInventoryProfile: Boolean;
     
        trigger OnOpenPage()
        var
            SessionSettings: SessionSettings;
            GetProfile: Text;
        begin
            SessionSettings.Init();
            GetProfile := SessionSettings.ProfileId();
            IsInventoryProfile := (UpperCase(GetProfile) = 'YOUR PROFILE ID ');// It's hard coded make sure it's exact
        end;
    }
    //RWN
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,603 Super User 2025 Season 2 on at

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans