Teach Me NAV
A site to support our book 'Implementing Microsoft Dynamics NAV 2009'.
Where did my xRec go?

In the RoleTailored client on a Page, the xRec does not contain a record when you are inserting new records into a sub page. Previously if you wanted to know where you had pressed F3 to insert a line you could take a look at xRec and would know which line you were on when you pressed F3.

Unfortunately in the RTC the xRec is completely blank (when checking in the field validation triggers).

Fortunately the xRec is not blank when it hits the onNewRecord() trigger so you can have a global variable on your form (I called mine g_MyXRec) and then assign it in that trigger, all is OK again.

Here is an example of the OnNewRecord in the Page 46 Sales Order Subform…

Type := xRec.Type;
CLEAR(ShortcutDimCode);
// My code added to allow me to see xRec -->
g_MyXRec := xRec;

With this code in place, I can now use g_MyXRec to see which record I was on when I pressed Ctrl+Ins.


Posted 11-02-2009 11:08 a.m. by David Roys
Powered by Community Server (Non-Commercial Edition), by Telligent Systems