Copying record from one table to another.

mysamzamysamza Member Posts: 66
I have a custom table that I want Posted Sales Invoice header records to be in.

So, Sales Invoice Header table to myowntable.
Now, on the OnAfterInsert trigger of the Sales Invoice Header table, I wrote the following code so that once a new record is created in the Sales Invoice Header table it gets copied over to myowntable.

All seems ok except that Amount and Amount Including VAT shows 0.00 in myowntable. All other fields i.e. No., Sell-to Customer no., Due Date.. All gets copied expect Amount and Amount Including VAT.
trigger OnAfterInsert()

    var

        recProof: Record "Proof of Delivery";

    begin

         with recProof do begin

        Evaluate(recProof."No.", Rec."No.");

        recProof."Sell-to Customer No." := Rec."Sell-to Customer No.";

        recProof."Due Date" := Rec."Due Date";

        recProof.Amount := Rec.Amount;

         recProof."Amount Including VAT" := Rec."Amount Including VAT";

        recProof."Currency Code" := Rec."Currency Code";

        recProof."Remaining Amount" := rec."Remaining Amount";

        recProof."Location Code" := rec."Location Code";

      Insert();

         end;

    end;

Best Answer

Answers

Sign In or Register to comment.