web
You’re offline. This is a read only version of the page.
close
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...
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
    133 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
    95,729 Super User 2025 Season 2 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
    95,729 Super User 2025 Season 2 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

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 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans