Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 45 Next »

This article was written for legacy versions of Mobile WMS extension

New events was introduced in version 5.14 and this article was updated accordingly, see How-to: Create header

It is recommended to always keep your Mobile WMS extension up to date

Description

How to create a new header for Planned functions, in order to filter which documents to include (or exclude).

Creating new functionality

This articles describes creating a new custom header, this is only needed when creating entirely new functionality.

Perhaps you looking for filtering standard headers?

  1. How-to: Filter Orders
  2. How-to: Filter Orders - Complex

What is a Header


Step 1 - Define Header and Filters 

Use OnGetReferenceData_OnAfterCreateHeaderConfigurations (v5.00-5.13) to create you new header.


    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterCreateHeaderConfigurations''', true, true)]
    local procedure OnGetReferenceData_OnAfterCreateHeaderConfigurations(var _HeaderConfigurationElement: Record "MOB HeaderField Element")
    begin
        with _HeaderConfigurationElement do begin
            Create('MyReceiptFilters')// New Header name to use instead of "ReceiveOrderFilters"



            // Add standard location filter - this is already handled in standard Receive
            AddList_Location(1);

            // Add our new custom filter - this is declared fully. It is a Text field.
            Create_TextField(2'DocumentNoFilter');
            Set_label('Doc. filter label:');
            Set_clearOnClear(true);
            Set_acceptBarcode(true);
            Set_length(20);
            Set_optional(true);
        end;
    end;


Tip

  • Note how helper-functions like Add_Location and Add_TextValue are used
  • There are many more to choose from


Step 2 - Modify Application.cfg

We have created a new header for Receive.

Currently you cannot overrule an existing header, so you must modify the standard Receive header in Mobile configuration like so:

<page id="Receive" type="OrderList" icon="mainmenureceive">
  <title defaultValue="@{PageReceiveOrderListTitle}" />
  <orderListConfiguration automaticOrderSelectionAfterFilter="true">
    <service id="Receive" />
        
    <!--CUSTOM--> 
    <!--<filter configurationKey="ReceiveOrderFilters" />-->
    <filter configurationKey="MyReceiptFilters" />
    <!--CUSTOM--> 
        
    <list listId="Orders" />
    <onOrderSelected navigateTo="ReceiveLines" />
    <unlockOrder title="@{ReleaseOrderMenuItem}"/>
  </orderListConfiguration>
</page>



Step 3 - Select your document event

Select all the events for the Planned function you are working on (We used "Receive" in this guide)

Supported events

Filter by label

There are no items with the selected labels at this time.

 

Step 4 - Structure your code

Make sure to affect all related documents.

A change in filter "PO Number" must affect both:

  • Receiving on "Warehouse Receipts" (based on Purchase orders)
  • Receiving directly on "Purchase Orders"

Make your code callable from both events:

  • OnGetReceiveOrders_OnSetFilterPurchaseOrder

  • OnGetReceiveOrders_OnSetFilterWarehouseReceipt

Tips:

  • Create a new procedure and call it from both events
  • Line filters affect which Order Headers are relevant.
    • If no Order Lines exists for a Header. The header is not included in the response.



Step 5 - Handle each document event

There are four OnSetFilter-events for Receive.


Currently, when creating custom headers, you have to handle ALL events even if you don't need them.

  • This is scheduled to change in 2020.



[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterWarehouseReceipt''', true, true)]
procedure OnGetReceiveOrders_OnSetFilterWarehouseReceipt(_HeaderFilter: Record "MOB NS Request Element"; var _WhseReceiptHeader: Record "Warehouse Receipt Header"; var _WhseReceiptLine: Record "Warehouse Receipt Line"; var _IsHandled: Boolean)
begin
    // [Scenario] Handle/Apply filter to Warehouse Receipts


    if _HeaderFilter.Name = 'DocumentNoFilter' then begin
        if _HeaderFilter."Value" <> '' then
            _WhseReceiptHeader.SetRange("No.", _HeaderFilter."Value");
        _IsHandled := true;
    end;

end;


[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

    // [Scenario] Handle filter for Purchase Orders
    if _HeaderFilter.Name = 'DocumentNoFilter' then
        _IsHandled := true;

end;

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterSalesReturnOrder''', true, true)]
procedure OnGetReceiveOrders_OnSetFilterSalesReturnOrder(_HeaderFilter: Record "MOB NS Request Element"; var _SalesReturnHeader: Record "Sales Header"; var _SalesReturnLine: Record "Sales Line"; var _IsHandled: Boolean)
begin

    // [Scenario] Handle filter for Sales Return Orders
    if _HeaderFilter.Name = 'DocumentNoFilter' then
        _IsHandled := true;
end;

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnGetReceiveOrders_OnSetFilterTransferOrder''', true, true)]
procedure OnGetReceiveOrders_OnSetFilterTransferOrder(_HeaderFilter: Record "MOB NS Request Element"; var _TransferHeader: Record "Transfer Header"; var _TransferLine: Record "Transfer Line"; var _IsHandled: Boolean)
begin

    // [Scenario] Handle filter for Transfer Orders
    if _HeaderFilter.Name = 'DocumentNoFilter' then
        _IsHandled := true;
end;

   

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterCreateHeaderConfigurations''', true, true)]
    local procedure OnGetReferenceData_OnAfterCreateHeaderConfigurations(var _HeaderConfigurationElement: Record "MOB RefD HeaderConfig Element")
    begin
        with _HeaderConfigurationElement do begin
            Create('MyReceiptFilters')// New Header name to use instead of "ReceiveOrderFilters"

            // -- Add the header Filters --

            // Add standard location filter - this is already handled in standard Receive
            AddList_Location(1);

            // Add our new custom filter - this is declared fully. It is a Text field.
            Add_TextValue(
                 2//id
                 'DocumentNoFilter',//name
                 'Doc. filter label:',          //label
                 100,               //label width
                 true,              //clear on clear
                 true,              //accept barcode
                 20,                //length
                 true,              //optional
                 '',                //search type
                 '',                //ean GS1Ai
                 false);            //locked
        end;
    end;

Press the filter icon to show the header filter

Receive Order filter

Put-away Order filter


Pick Order filter


  • No labels