Retrieve Available Serial Numbers also based on Lot

We Lot track almost all parts and are working on introducing serial number tracking for a subset of parts. In testing that out, we discovered that the “Retrieve Available” serial numbers in the serial number selection dialog box does not filter for the Lot number that is entered—if there are multiple lot numbers in the same bin, then the user would have to know ahead of time which available serial numbers are associated with which lot numbers. Want to get to where user only has to enter the Lot and then when they retrieve available serial numbers it is only those associated with the Lot that they entered.

The trace reveals to me the where clause used in the GetList method of the SerialNo BO includes the expected (partnum, INVENTORY SNStatus, WarehouseCode, & BinNum), but does not include the Lot Num. Playing around with this BO/Method in the REST help page, I am able to add the LotNum to the where clause and get back a list of available serial numbers associated to the lot entered.

Is there a way to programmatically do this in every instance where the Serial Number selection needs to happen (inv transfer, receipt entry, shipping, material issue, etc.)? I assume that the best way to go about it is to create a Function that pulls the list of serial numbers, and then call that function in each Method that requires serial number selection, passing the lot number the user has entered in the respective form. However, it appears that the LotNum is a view (not db) field in those forms, so not entirely sure where to pull it from to pass through; I do see that it does reside in various datasets (e.g. InvTransferDataSet).

Found this older topic that is doing something different, but similar… wondering if any of that solution would be the way to go for me (also trying to stay contained to widgets as much as possible, preparing for eventual upgrade from 10.2.700 to latest Kinetic version):

https://www.epiusers.help/t/efx-for-inventory-transfer-with-serial-numbers/88212/23https://www.epiusers.help/t/efx-for-inventory-transfer-with-serial-numbers/88212/23