Get record by fields other than the primary key

On the “Reservation Entries” page there is a field called “Reserved for”, which I need to also appear on the “Purchase Order Subform” page, for which I am developing an extension.

On the Reservation Entries page, this field uses the “CreateForText” procedure of the “Reservation Engine Mgt.” Codeunit

This procedure requires a parameter of type Record “Reservation Entry”

In my extension of the page “Purchase Order Subform”, I want to use this same procedure, but I need the parameter “Reservation Entry”, which would be the reserved in each line of the table “Purchase Line”.

I have noticed that the “Source ID” and “Source Ref. No.” fields of “Reservation Entry” refer to the fields “Document No.” and “Line No.” from Purchase Line, so in my extension I want to create a variable of type Record “Reservation Entry”, but that meets the criteria “Source ID” = “Document No.” and “Source Ref. No.” = “Line No.”, how could I do this?

I had planned to use the “Get” method of “Record”, but this only allows to use the primary key as a filter, and I would like to use the fields “Source ID” and “Source Ref. No.”

Have a look at “SetRange”/“SetFilter” methods along with the various “FIND” methods.

Also note that a single document line (“Purchase Line” in this example) may be linked to multiple “Reservation Entry” records. This is why base function typically consolidates these records into a temporary “Tracking Specification” record set for display.

1 Like