Copying record from one table to another.

mysamza
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.
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;
0
Best Answer
-
From:
https://docs.microsoft.com/en-us/dynamics-nav/calcfields-function--record-
"FlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use either the CALCFIELDS function or the SETAUTOCALCFIELDS Function (Record) to update them."5
Answers
-
Look at the definition of those fields in the Sales Invoice Header table and see if you can figure out why. Hint: look at the fieldclass property1
-
From:
https://docs.microsoft.com/en-us/dynamics-nav/calcfields-function--record-
"FlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use either the CALCFIELDS function or the SETAUTOCALCFIELDS Function (Record) to update them."5 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions