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.


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




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