We added a customized category field in Item table and differentiate items of sale and purchase according to this field value. Now we have to filter item lookup in sales order and purchase order subform in NO. field by hardcoding category value in code when type = Item , so how we can do it?
Actually its not only on sale and purchase , we have different categories so we have to filter item popup window on No. field according to category but thanks for the information.
are you only categorizing your items based on if its for sale or for purchase, and nothing else? If its only that you can achieve what you're looking for with out of the box functionality.
On the item card there are two fields, purchasing blocked and sales blocked. If an item is marked as purchasing blocked, it wont appear in the drop down in sales documents. If its marked as sales blocked, it wont appear in the drop down in purchase documents
can't find codeunit like this.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156