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

Community site session details

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

Codeunit to modify page fields

(0) ShareShare
ReportReport
Posted on by 30

Hello guys. 
I’ve made a codeunit that does some stuff when a sales order is released…. 
i would like that codeunit to also modify some fields on the sales order page, so when it’s triggered I wanna make some fields not editable on the page “Sales Order”

i can’t find the key to make it work… I can’t insert a car called “test: page “Sales order””

in my optics it should be possible to browse the page test.testfield.editable = false

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    89,846 Super User 2025 Season 2 on at
    RE: Codeunit to modify page fields

    Hi, Hi, I think the problem is that you have to close the current page, set the Editable property, and reopen the page.

    pastedimage1651015117380v1.png

    Hope this helps.

    THanks.

    ZHU

  • RasmusAKEA Profile Picture
    30 on at
    RE: Codeunit to modify page fields

    Yes indeed - i could use a field to change it with - actually i have that field already, when it changes to <> '' i must trigger something - basically i can't see how to do that on the PageExtension page - so far seems like ionly have access to the fields from that page. 

    So if i could make a Trigger when that record changes, i could then set the property of 3 other fields.... 

    But so far i can't get the Trigger to work lige i expect - and also when i do like this: 

    Modify(TestField)

    {

    trigger OnValidate()

    If TestField <> '' Then Begin

    rec.TestField2.Editable = False;

    End;

    Seems like i don't get allowed to edit another field inside the TestField.... Also i can't get my "OnValidate" Trigger to run - if i test with a message... Basically i need a trigger when a field is changed on the page - that can do events on the fields :) 

    The Post yzhums  posted, is almost what i want - but can't figure out to change as i want :) 

  • Suggested answer
    YUN ZHU Profile Picture
    89,846 Super User 2025 Season 2 on at
    RE: Codeunit to modify page fields

    Hi, hope the following two posts can give you some new hints

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

    https://yzhums.com/16756/

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

    https://yzhums.com/9132/

    Thanks.

    ZHU

  • Suggested answer
    JAngle Profile Picture
    113 on at
    RE: Codeunit to modify page fields

    Could you have an additional field? If the value is true it can control the page fields. Use a page extension and modify the visible property. You could also add a new global variable to a page extension and have it determined in the OnOpenPage trigger. Again using the value as the visible property for any fields

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans