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

Create page that allows the user to modify a disabled field

(0) ShareShare
ReportReport
Posted on by 92

Sometimes users forget to fill in the "Fiscal Invoice Number PAC" field in the Purchase Invoices and since when the invoices are registered they can no longer be modified, I would like to create a page that allows to modify said field of the Posted Purchase Invoice page . Any idea how I could do this? I'm lost

  • Suggested answer
    YUN ZHU Profile Picture
    81,785 Super User 2025 Season 1 on at
    RE: Create page that allows the user to modify a disabled field

    Hi, I am leaning towards Mohana's solution, for example, I want to add a change to the Payment Term Code in Posted Purchase Invoice.

    pastedimage1649899066888v1.png

    pastedimage1649899079131v2.png

    Add new field to "Posted Purch. Invoice - Update" page.

    pastedimage1649899131572v3.png

    pastedimage1649899403475v4.png

    pastedimage1649899412932v5.png

    pastedimage1649899944087v6.png

    Source code:

    pageextension 50111 MyExtension5 extends "Posted Purch. Invoice - Update"
    {
        layout
        {
            addafter("Payment Method Code")
            {
                field("Payment Terms Code"; Rec."Payment Terms Code")
                {
                    ApplicationArea = All;
                }
            }
        }
    }
    
    codeunit 50111 MyCodeunit5
    {
        [EventSubscriber(ObjectType::Page, Page::"Posted Purch. Invoice - Update", 'OnAfterRecordChanged', '', false, false)]
        local procedure OnAfterRecordChanged(var PurchInvHeader: Record "Purch. Inv. Header"; xPurchInvHeader: Record "Purch. Inv. Header"; var IsChanged: Boolean; xPurchInvHeaderGlobal: Record "Purch. Inv. Header");
        begin
            IsChanged := PurchInvHeader."Payment Terms Code" <> xPurchInvHeaderGlobal."Payment Terms Code";
        end;
    
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch. Inv. Header - Edit", 'OnBeforePurchInvHeaderModify', '', false, false)]
        local procedure OnBeforePurchInvHeaderModify(var PurchInvHeader: Record "Purch. Inv. Header"; PurchInvHeaderRec: Record "Purch. Inv. Header");
        begin
            PurchInvHeader."Payment Terms Code" := PurchInvHeaderRec."Payment Terms Code";
        end;
    }

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Create page that allows the user to modify a disabled field

    I do not have that field in my version of Business Central.

    But something like this should work:

    pageextension 50101 PostedPurchaseInvoiceExt extends "Posted Purchase Invoice"

    {

       layout

       {

           modify("Fiscal Invoice Number PAC")

           {

               Editable = true;

           }

       }

    }

    If that field is marked as none editable in the table definition you might have to do a workaround for that.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,222 Super User 2025 Season 1 on at
    RE: Create page that allows the user to modify a disabled field

    Please look at Update Document Action and extend the page with required field

    update-posted-doc.jpg

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,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,009 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/blogs/post/?postid=%27nvOpzp;%20AND%201=1%20OR%20(%3C%27%22%3EiKO))," - Too many )'s.