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...
Answered

How to make field to non editable field on condition?

(1) ShareShare
ReportReport
Posted on by 60
I have created 2 fields, I would like to make it non editable on user group condition.
 
when the user is in user group /PURCH/ then cannot edit Procurement note.
 
or when the user is in user group /SALES/ then can edit Procurement note.
 
Thanks in advance.

Here are the code below:
 
tableextension 80000 PurchHeadExt extends /Purchase Header/
{
    fields
    {
        // Add changes to table fields here
        field(80101; /Procurement Note/; Text[2048])
        {
            Caption = 'Procurement Note';
            DataClassification = CustomerContent;
        }
        field(80102; /Vendor Note/; text[2048])
        {
            Caption = 'Vendor Note';
            DataClassification = CustomerContent;
        }
    }
}
 
pageextension 80000 PurchOrderExt extends /Purchase Order/
{
 
    layout
    {
        addlast(General)
        {
            field(ProcurementNote; rec./Procurement Note/)
            {
                Caption = 'Procurement Note';
                ApplicationArea = suite;
                MultiLine = true;
                ShowCaption = true;
 
            }
 
            field(VendorNote; rec./Vendor Note/)
            {
                Caption = 'Vendor Note';
                ApplicationArea = suite;
                MultiLine = true;
                ShowCaption = true;
            }
 
        }
 
    }
 
}
I have the same question (0)
  • black_s Profile Picture
    328 on at
    Hi,
     
    A better design would be to add a boolean on the user setup and tick for those who can access.

    Use an on OpenPage trigger to get the Usersetup of the user currently logged in. The fetch the contents of that field and assign to a variable.

    Then assign the variable to the editable component field.

     
    The issue am finding with the user group route  is if a user is assigned to both user groups, the logic will fail



  • Suggested answer
    TL-04060938-0 Profile Picture
    60 on at
    could you please let me know the codes?
     
  • Verified answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at
    Hi, You can refer to the standard documentation below.
    PS: Deprecating InDataSet attribute used for global variables in Pages (The InDataset attribute is unused)
     
    Thanks.
    ZHU

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 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans