I'm using Dynamics nav 2009 R2. I have 2 forms Clients and Invoice Header.
In my Invoice Header table i have a field named "Clientid" and "payment date".
Right now i have this code on my ClientId OnAfterValidate() trigger
InvoiceHeaderFacturatie.GET;
MESSAGE(FORMAT(ClientId));
CurrForm.SETSELECTIONFILTER(InvoiceHeaderFacturatie);
And on my payment date field i have a CodeUnit on the OnActivate() trigger with the following code.
PaymentDate.PDTable(InvoiceHeaderFacturatie);
And here the code in the CodeUnit is
MESSAGE(FORMAT(pInvoiceHeaderFacturatie.ClientId));
When i pick a ClientId a message shows the right ClientId number but when i go the payment date its just show 0.
Answers
SETSELECTIONFILTER sets a filter such that when you iterate over the record, you will visit all records that were selected in the form. It does not alter any fields.
Try this code in your Codeunit
If you intended to get the current record only try
Btw. what is supposed to do? If this is a setup table with only one record, SETSELECTIONFILTER does not make any sense at all, otherwise the GET without any primary key values probably does not make much sense.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/