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

Announcements

No record found.

News and Announcements icon
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
    JAngle Profile Picture
    150 on at

    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

  • Suggested answer
    YUN ZHU Profile Picture
    97,970 Super User 2026 Season 1 on at

    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

  • RasmusAKEA Profile Picture
    30 on at

    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
    97,970 Super User 2026 Season 1 on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,161 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,046 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 932 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans