Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Use this event to

Excerpt

Filter Purchase Orders to be displayed at the mobile device.

...


With this event you can perform basic record filtering of Orders.
, consider OnGetReceiveOrders_OnInclude... instead. 


Template

[EventSubscriber(ObjectType::CodeunitCodeunit::"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::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterPurchaseOrder''', true, true)]
    procedure OnGetReceiveOrders MyOnGetReceiveOrders_OnSetFilterPurchaseOrder(_HeaderFilter: Record "MOB NS Request Element"; var _PurchHeader: Record "Purchase Header"; var _PurchLine: Record "Purchase Line"; var _IsHandled: Boolean)
    var
    PurchaseHeader        PurchaseHeaderRecord "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. abort process and force user to change filter with an error message


            if _HeaderFilter.Name = 'PurchaseOrderNumber' then
                    if PurchaseHeader.Get(PurchaseHeader."Document Type"::"Order", _HeaderFilter."Value") and (PurchaseHeader.Status <> PurchaseHeader.Status::Releasedthen
            Error                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 :=

        _IsHandled := false; // No point in handling the filter or not Dont handle the filter, as Error stops the entire proces if needed so standard filter works are normal

    end;



Example 2: Add custom filters to Standard headers

...