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...
Answered

FieldRef not changing at runtime

(0) ShareShare
ReportReport
Posted on by

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.

  • Verified answer
    Suresh Kulla Profile Picture
    45,180 on at
    RE: FieldRef not changing at runtime

    Try using CLEAR(lFieldRef) that way it clears and will reset.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans