Skip to main content

Notifications

Community site session details

Community site session details

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

How to make a field non editable based on a condition(boolean field)

(0) ShareShare
ReportReport
Posted on by 35

how to make field 'quantity' to non editable in sales line for child item after exploding bom?

i have added  a boolean field in assembly bom page and set to true so when it is set to true and this parent item is set Explode BOM then the child item qty should be non editable? is it possible?

i have tried with an event subscriber but editable property is available ?

 any idea? is it possible?

  • Suggested answer
    YUN ZHU Profile Picture
    81,360 Super User 2025 Season 1 on at
    RE: How to make a field non editable based on a condition(boolean field)

    Hi, just adding some info.

    The page mode that the page was opened in (Editable of the page)

    https://yzhums.com/9132/

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

    https://yzhums.com/16756/

    Dynamic Visibility of Controls (Hide and show fields dynamically)

    https://yzhums.com/14752/

    Hope these give you some new hints too.

    Thanks.

    ZHU

  • RahulKrishna Profile Picture
    35 on at
    RE: How to make a field non editable based on a condition(boolean field)

    thank you! it was helpful,

  • Suggested answer
    Nitin Verma Profile Picture
    21,544 Moderator on at
    RE: How to make a field non editable based on a condition(boolean field)

    Hi,

    you can use InDataSet property with your Variable.

    learn.microsoft.com/.../devenv-indataset-attribute

  • Verified answer
    Shathika Karunaratne Profile Picture
    on at
    RE: How to make a field non editable based on a condition(boolean field)

    Hi,

    Yes you can do it in a simple way. 

    In below I am setting the editable field in Currency Code in Customer Page. You need a global variable EditableCurrCode. and then put it to the OnOpenPage and OnAfterGetRecord Triggers to check simply the Customer Posting Group is Local or not. If it is Local, the Currency Code field cannot be edited.

    Hope you got the method from this easy example.

            modify("Currency Code")
            {
                Editable = EditableCurrCode;
            }
        }

        trigger OnOpenPage()
        begin
            if Rec."Customer Posting Group" = 'Local' then
                EditableCurrCode := false
            else
                EditableCurrCode := true;
        end;

        trigger OnAfterGetRecord()
        begin
            if Rec."Customer Posting Group" = 'Local' then
                EditableCurrCode := false
            else
                EditableCurrCode := true;
        end;

        var
            EditableCurrCode: Boolean;
    Thanks.
    Please verify this answer if it helps you
  • RahulKrishna Profile Picture
    35 on at
    RE: How to make a field non editable based on a condition(boolean field)

    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans