In Navision 2018 CU2, we have codeunit that makes sales/purchase invoices/credit memos from custom tables that contain records with the data for the header and the lines for these documents.
(These custom records are published via API pages so an external accounting software can send their data to these records; this is an integration of an external accounting software with NAV).
The Due Date can differ from the Due Date calculated using the Payment Terms in Navision.
First, we validate the payment terms code in Navision.
After that, we validate the Due Date from that custom table.
This has been tested and this has worked before:
The correct Due Date (from our custom page) was on the sales/purchase document (not the Due Date calculated by the Payment Terms in Navision).
The code is as follows
lFieldRef := lRecRef.FIELD(23); //Payment Terms Code
lFieldRef.VALIDATE;
lFieldRef := lRecRef.FIELD(24); //Due Date
lFieldRef.VALIDATE(lRecCustomHeaderTable."Due Date");
Recently however, this stopped working correctly.
Nothing in the code has changed.
The entire Navision server has been rebooted but the problem remains.
Debugging shows that lFieldRef keeps pointing to field(23) even when the debugger reaches the line below:
lFieldRef.VALIDATE(lRecCustomHeaderTable."Due Date");
For some reason, "lFieldRef := lRecRef.FIELD(24);" does not trigger pointing to field 24 but keeps pointing to field 23.
(lRecRef is either 36 (Sales Header) or 38 (Purchase Header), depending on the incoming document being a sales or purchase invoice/credit memo.)
This seems strange behaviour.
Does anyone have any experience with a similar problem or perhaps even be aware of a fix?
Many thanks.
Try using CLEAR(lFieldRef) that way it clears and will reset.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,493 Most Valuable Professional
nmaenpaa 101,148