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

Notifications

Announcements

Community site session details

Community site session details

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

Edit a field based on a checkbox,

(0) ShareShare
ReportReport
Posted on by 60

Hello, 

I have a task to make a custom field editable based on a checkbox
If checkbox is checked the user can edit the specific field.

I have create a boolean variable EditCustomField, 
And in Onvalidate of the checkbox and o Onaftergetrecord (page) i have done this:

IF Edit = TRUE THEN 
EditCustomField := TRUE;

it does not wokr. 
Could you help me please?

I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    96,374 Super User 2025 Season 2 on at

    Hi, Hope the information below can give you some hints.

    Dynamic Visibility of Controls (Hide and show fields dynamically)

    https://yzhums.com/14752/

    Switching a page to non-editable in real time via a field value

    https://yzhums.com/16756/

    Thanks.

    ZHU

  • Verified answer
    Ayala Profile Picture
    112 on at

    Hello,

    I have some smaples using Enabled property, on page fields Enabled attribute you must assign EditCustomField variable, something like this:

                   field("Warning 1"; Rec."Warning 1")

                   {

                       Enabled = EditCustomField;

                       ApplicationArea = All;

                   }

    Using Enabled must works too, I have created this sample page and it works:

    page 60000 TestPage

    {

       PageType = Card;

       ApplicationArea = All;

       UsageCategory = Administration;

       SourceTable = Integer;

       SourceTableTemporary = true;

       SourceTableView = where(Number = Const(1));

       Editable = true;

       layout

       {

           area(Content)

           {

               group(GroupName)

               {

                   field(SearchString1; SearchString1)

                   {

                       ApplicationArea = All;

                       Editable = CanEdit2;

                   }

                   field(SearchString2; SearchString2)

                   {

                       ApplicationArea = All;

                       Editable = CanEdit2;

                   }

                   field(ItemEntry; ItemEntry)

                   {

                       ApplicationArea = All;

                       Editable = CanEdit2;

                   }

                   field(CanEdit; CanEdit)

                   {

                       ApplicationArea = All;

                       trigger OnValidate()

                       begin

                           CanEdit2 := CanEdit;

                       end;

                   }

               }

           }

       }

       var

           SearchString1: Text;

           SearchString2: Text;

           CanEdit: Boolean;

           CanEdit2: Boolean;

       trigger OnOpenPage()

       begin

           CanEdit := true;

           CanEdit2 := true;

       end;

    }

    Is not necessary to have two boolean variables, with one only CanEdit you can avoid OnValidate code.

  • Verified answer
    Mohana Yadav Profile Picture
    61,025 Super User 2025 Season 2 on at

    can you paste all your code?

    Did you assign the variable to the editable property of the custom field?

    Is there any reason why you want to do it as editable only?

    You can also simply write code under custom field onvalidate to check the boolean field

    TESTFIELD(boolean,true);

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

News and Announcements

Season of Giving Solutions is Here!

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 1,572

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 789 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 693 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans