OnLookupOnPostShipment_OnIncludeWarehouseShipment
Use this event to
Add filter conditions for Warehouse Shipment that cannot be solved by OnSetFilter-event.
Description
This event is for filtering Warehouse Shipments in the special lookup page "OnPostShipment". Do not confuse with the the Shipment OrderList page (described in GetShipOrders).
The event is triggered after filters have been applied to the Warehouse Shipment (when the record is read).
The Warehouse Shipment can be excluded from the response by setting the parameter _IncludeInLookup to false.
For performance reasons this event should be used only when it is not possible to use OnLookupOnPostShipment_OnSetFilterWarehouseShipment-event.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Lookup", 'OnLookupOnPostShipment_OnIncludeWarehouseShipment', '', true, true)]
local procedure OnLookupOnPostShipment_OnIncludeWarehouseShipment(_WhseShipmentHeader: Record "Warehouse Shipment Header"; var _IncludeInLookup: Boolean)
begin
end;
Example
// [Example]: Do not include in lookup response if Customer is blocked
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Lookup", 'OnLookupOnPostShipment_OnIncludeWarehouseShipment', '', true, true)]
local procedure MyOnLookupOnPostShipment_OnIncludeWarehouseShipment(_WhseShipmentHeader: Record "Warehouse Shipment Header"; var _IncludeInLookup: Boolean)
var
WhseShipmentLine: Record "Warehouse Shipment Line";
SalesHeader: Record "Sales Header";
Customer: Record Customer;
begin
// Loop lines
WhseShipmentLine.SetFilter("No.", _WhseShipmentHeader."No.");
if WhseShipmentLine.FindSet() then
repeat
if WhseShipmentLine."Source Document" = WhseShipmentLine."Source Document"::"Sales Order" then begin
SalesHeader.Get(WhseShipmentLine."Source Subtype", WhseShipmentLine."Source No.");
// Exclude the Shipment if Customer is blocked
if Customer.Get(SalesHeader."Sell-to Customer No.") and (Customer.Blocked in [Customer.Blocked::Ship, Customer.Blocked::All]) then
_IncludeInLookup := false;
end;
until (WhseShipmentLine.Next() = 0) or not _IncludeInLookup;
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 Order Lines — Examples of filtering Order Lines .
-
How-to: Filter Orders - Complex — Examples for including/excluding orders using complex per-document filtering
Version History
Version | Changes |
---|---|
MOB5.21 | Introduced |