Use this event to
Filter Purchase Orders to be displayed at the mobile device.
Description
affects which Orders are displayed.
With this event you can perform basic record filtering,
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterPurchaseOrder', '', true, true)]
procedure OnGetReceiveOrders_OnSetFilterPurchaseOrder(_HeaderFilter: Record "MOB NS Request Element"; var _PurchHeader: Record "Purchase Header"; var _PurchLine: Record "Purchase Line"; var _IsHandled: Boolean)
begin
end;
Example 1: Modify standard header filter
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterPurchaseOrder', '', true, true)]
procedure OnGetReceiveOrders_OnSetFilterPurchaseOrder(_HeaderFilter: Record "MOB NS Request Element"; var _PurchHeader: Record "Purchase Header"; var _PurchLine: Record "Purchase Line"; var _IsHandled: Boolean)
var
PurchaseHeader: Record "Purchase Header";
begin
// [Scenario] Validate the standard "Purchase Order" filter,
// [Scenario] by checking the order is Open.
// [Scenario] If not, abort process and force user to change filter.
if _HeaderFilter.Name = 'PurchaseOrderNumber' then
if PurchaseHeader.Get(PurchaseHeader."Document Type"::"Order", _HeaderFilter."Value") and (PurchaseHeader.Status <> PurchaseHeader.Status::Released) then
Error('Purchase Order %1 is not released', PurchaseHeader."No."); // We use "error" since filter a single document no. (Error is not recommended for common filtering)
// _IsHandled := // No point in handling the filter or not, as Error stops the entire proces if needed
end;
Example 2: Add custom filters to Standard headers
You want to add an additional filter to a existing header.
Example 3: Handle custom header filter
See How-to: Create custom Orders header
More examples
-
Case: Filter Inventory Movements of Asmbl. Orders for specific Sales Order — The user wants to filter Warehouse Documents on specific Sales Order number, using the existing Planned Movements function.
-
How-to: Filter Orders — Examples for including/excluding orders using basic filtering
-
How-to: Filter Orders - Complex — Examples for including/excluding orders using complex per-document filtering
Version History
Version | Changes |
---|---|
MOB5.10 | Introduced |