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 50
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;
            }
 
        }
 
    }
 
}
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 78,034 Super User 2025 Season 1 on at
    How to make field to non editable field on condition?
    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
  • Suggested answer
    TL-04060938-0 Profile Picture
    TL-04060938-0 50 on at
    How to make field to non editable field on condition?
    could you please let me know the codes?
     
  • black_s Profile Picture
    black_s 328 on at
    How to make field to non editable field on condition?
    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



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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans