RE: Filter Item Lookup in Sales Order and Purchase Order Subforms
Hi Abdul Mateen,
To filter the item lookup in sales order and purchase order subforms based on the customized category field, you can modify the codeunit that is responsible for handling the lookup for the item field.
Here are the steps to achieve this:
1. Identify the codeunit responsible for handling the item lookup in the sales order and purchase order subforms. The codeunit is typically named "Sales- or Purchase Line Item Subform Management."
2. Open the codeunit in the development environment.
3. Locate the function that is responsible for retrieving the list of items for the lookup. The function is typically named "GetItemList."
4. Modify the function to filter the items based on the value of the customized category field.
5. Save the changes to the codeunit and compile it.
For example, if your customized category field is named "Item Category," you can modify the code as follows:
--------------------
ItemCategoryValue := 'Value to Filter';
IF ItemRec.FINDSET THEN
REPEAT
IF ItemRec."No." <> '' THEN BEGIN
ItemCategory := ItemRec."Item Category";
IF ItemCategory = ItemCategoryValue THEN BEGIN
ItemList.Add(ItemRec);
END;
END;
UNTIL ItemRec.NEXT = 0;
--------------------
In the above code, "ItemCategoryValue" is the value of the customized category field that you want to filter by. Replace it with the appropriate value for your situation.
Note that these changes will affect the item lookup in both the sales order and purchase order subforms, as they share the same codeunit.