Use this event to
Add filter conditions for Warehouse Receipt Headers that cannot be solved by OnSetFilter-event.
Description
This event is triggered after filters have been applied to the Warehouse Receipt Header. The event should be used only when it is not possible to use OnSetFilter-event to solve if the Header should be included in the OrderList response.
The Warehouse Receipt Header can be excluded from the OrderList response by setting the parameter _IncludeInOrderList to false.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnIncludeWarehouseReceiptHeader', '', true, true)]
procedure OnGetReceiveOrders_OnIncludeWarehouseReceiptHeader(_WhseReceiptHeader: Record "Warehouse Receipt Header"; var _IncludeInOrderList: Boolean)
begin
end;
Example
// [Example]: Do not include in order list if Vendor is blocked.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnIncludeWarehouseReceiptHeader', '', true, true)]
procedure OnGetReceiveOrders_OnIncludeWarehouseReceiptHeader(_WhseReceiptHeader: Record "Warehouse Receipt Header"; var _IncludeInOrderList: Boolean)
var
WhseReceiptLine: Record "Warehouse Receipt Line";
PurchaseHeader: Record "Purchase Header";
Vendor: Record Vendor;
begin
// Loop lines belonging to this, current Receipt
WhseReceiptLine.SetFilter("No.", _WhseReceiptHeader."No.");
if WhseReceiptLine.FindSet() then
repeat
if WhseReceiptLine."Source Document" = WhseReceiptLine."Source Document"::"Purchase Order" then begin
PurchaseHeader.Get(WhseReceiptLine."Source Subtype", WhseReceiptLine."Source No.");
// Exclude the Receipt if Vendor is blocked
if Vendor.Get(PurchaseHeader."Buy-from Vendor No.") and (Vendor.Blocked <> Vendor.Blocked::" ") then
_IncludeInOrderList := false;
end;
until (WhseReceiptLine.Next() = 0) or not _IncludeInOrderList;
end;
More examples
-
Case: Filter Receipts based on Comments — The user wants to filter Receipts on whether they have comments or not
-
How-to: Filter Orders - Complex — Examples for including/excluding orders using complex per-document filtering
Version History
Version | Changes |
---|---|
MOB5.13 | Introduced |