This problem happens on NAV 2013R2 build 37221. I didn’t check the other builds or versions.
Action on Warehouse Receipt (Page 5768) that then calls the warehouse subform ([or should I say Subpage?] Page 5769) because the action does something on the current Warehouse Receipt Line of the subpage.
To make this work, the action calls “CurrPage.WhseReceiptLines.PAGE.SomeAction();” (Here we DO have PAGE!)
In the subpage, I have a function that does the action (calling a codeunit to avoid putting code in the page, but that is another [PRS-]story…).
My story is about the fact that whatever record on the line I choose, the action is ALWAYS run on the FIRST line. How is that possible?
I noticed that in the header, the triggers “OnFindRecord” and “OnNextRecord” have some code in them. The reason is to search a record you can see as a warehouse employee. A filter might be better but again, this is … again … another story. Well, maybe not a good idea if you have some 100 of locations to which you are allowed to use…
So, I thought, I will create a global variable of the same record-type as the page and in the “OnAfterGetCurrRecord”-trigger, I will save the “Rec” into my variable. This is the code:
OnAfterGetCurrRecord()
//START
WarehouseReceiptLineREC := Rec;
//STOP
And it worked! And strangely also “Rec” now had the correct record.
Now I thought of something : I just put this code in the trigger:
OnAfterGetCurrRecord()
//
That’s correct. 1 line with just “//” in it and NO CODE!
But also this worked.
Читать дальше