SaveValues don’t work as expected in Worksheet Page

Recently I experienced a very strange behavior in NAV2016 with SaveValues and Worksheets. I made a worksheet like a Financial Journal with the following properties.

As you can see the “SaveValues” property is on and the “PageType” is Worksheet.

When testing my page I saw that the value in my global variable disappears when I toggle between multiple rows.
So when line 1 is selected I got the following data.

But when I switch to record 2 I will loose the “Customer No.” as you can see.

And when I go back to the first line the value is back.

Very strange because I would expect that the “SaveValues” property will handle this for me.
After testing and checking the “Financial Journal” I found the solution.

To make the values really been saved, I need to add some code in the “OnAfterGetCurrRecord” trigger.
And as you can see I may only be some comments.

Now when I toggle between the records the result is as I expect. The values are saved.

And if you check the “Financial Journal” page, you will see that there is code on this trigger too. When you remove all the code, it wouldn’t work either.

It is definitely not NAV2016 because I check NAV2013 as well and it has the same behavior.
Is this an undocumented feature?

Leave a Reply

Your email address will not be published. Required fields are marked *