CurrFieldNo reset

This post is merely to inform people to watch out about using CurrFieldNo.

Back to the beginning then.

I was looking into some issues with the Job Journal Line not calculating if inventory was available when i found the problem was related to the CurrFieldNo…

Database was a 5.0 SP1 that was run inside an 2009 R2 client.
If you take a look at 2009 R2 code, you will see that the availability checks happen first.
While in 5.0 we had the following:

You can see CheckItemAvailable is called after a few other checks and starts with following check:

The function was not executed due to CurrFieldNo being 0. After a bit of debugging I found it being filled first but reset later on.

A search on PartnerSource brought following KB article:

The CurrFieldNo field is set to 0 when the current record is passed to a function in a different object in Microsoft Dynamics NAV 4.0

SYMPTOMS

When the current record is passed to a function in a different object in Microsoft Dynamics NAV 4.0, the CurrFieldNo field is set to 0.
This problem occurs if the following conditions are true: 

  • The current record is passed by reference.
  • The object to which the current record is passed executes a VALIDATE function.

Well, it’s not only 4.0. Even 5.0 or 2009 R2 executable has the problem.

I solved it by adding the following simple lines:

Hopefully someone will be helped by this.

Regards

One thought on “CurrFieldNo reset

  1. Pingback: CurrFieldNo reset | Pardaan.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.