SETSELECTIONFILTER sends empty record

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

And on my payment date field i have a CodeUnit on the OnActivate() trigger with the following code.

And here the code in the CodeUnit is

When i pick a ClientId a message shows the right ClientId number but when i go the payment date its just show 0.


  • vaprogvaprog Member Posts: 955
    Hi Alex

    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 pInvoiceHeaderFacturatie.FINDSET THEN
      UNTIL pInvoiceHeaderFacturatie.NEXT = 0;

    If you intended to get the current record only try
    pInvoiceHeaderFacturatie := Rec;

    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.
  • RockWithNAVRockWithNAV Member Posts: 914
    SETSELECTIONFILTER works on how much record set you have selected.
Sign In or Register to comment.