Bug? OnAfterGetRecord() irrational behaviour

benmibnavbenmibnav Member Posts: 3
edited 2013-06-05 in NAV Three Tier
Hi folks, I ran into what might be a bug in NAV. OnAfterRecord() gives weird values for the current record.

When I open a Page from another Page progammatically (SetRecord&SetTableView&Run), the OnAfterGetRecord() on the opened Page starts behaving really weird after changing the record.

Prerequisite:
- Run the second Page ("card") from the Action on the first ("list").
- Change the record, eg. ctrl+PageUp or Actions->Next

What now happens:
- On editing a text-field on the "card" (source is a global variable), OnAfterGetRecord() gets triggered and returns a wrong value for the current record.
- On changing the record again, OnAfterGetRecord() gets triggered multiple times in a row, returning weird values for the current record.

I made as simplified an example as I could, to demonstrate this behaviour. I wasn't allowed to upload the .txt of .fob, so they are here:
http://users.tkk.fi/~joberg/foo/aftgetrec_navbug.zip

Am I opening the Page in a wrong way?
Is this a bug or is it SUPPOSED to happen - what exactly happens?

I tried setting the record in different ways. Setrecord() is what causes this in the example. Even if I run a FIND('-') for a Record variable first, clear the filters, and then use Setrecord(), I get the same result. I even tried creating a function "chooseRecord(number)" in the cardPage, which simply ran a Rec.GET, and then I ran that from the listPage before running the cardPage - but the same thing happens. IF this is a bug, how could I circumwent this?


TL;DR: OnAfterGetRecord() works weird, test the objects in the .zip-file above. I want to be able to open a Page for a specific record from C/AL, with OnAfterGetRecord() working as it does if I open the Page manually.

Answers

  • benmibnavbenmibnav Member Posts: 3
    Thanks for your help, BlackTiger. I looked into OnAfterGetCurrRepord(), and it seems to give me what I want, without this fuzzy behavior.

    To continue on the topic just slightly - WHAT DOES OnAfterGetRecord() actually do, and why does it act all stupid in the original scenario I describe?
Sign In or Register to comment.