Description
Excerpt |
---|
How to create a header for Planned functions, in order to filter which documents to include (or exclude). |
Select the right approach
Please consider reading these article before continuing to create a custom header.
What is a Header?
Info |
---|
This article is written for "Receipt Orders" but can be used as inspiration for all "planned" functions (Receive, Put-away, Pick, Move ,Ship) |
Step 1 - Define Header and Filters
Use the OnGetReferenceData_OnAfterCreateHeaderConfigurations to create you new header.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"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"
AddHeaderFilters(_HeaderConfigurationElement);
end;
end;
local procedure AddHeaderFilters(var _HeaderConfiguration: Record "MOB RefD HeaderConfig Element")
begin
with _HeaderConfiguration do begin
// Add the header Filters
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;
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:
Code Block | ||||
---|---|---|---|---|
| ||||
<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 (Content by label) | ||||||
---|---|---|---|---|---|---|
|
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.
You are given these parameters:
_HeaderFilter.Name:- I.e.: 'AssignedUser', 'ScannedValue', 'Location' etc.
- Or custom name given in OnGetReferenceData_OnAfterCreateHeaderConfigurations
_HeaderFilter.Value:The filter value collected from the mobile user. Use or Modify this value for filtering.
_WhseReceiptHeader:
- Resulting filtering set of Order Lines.
- Apply filters to affect the resulting OrderList.
- Line filters also affects which Order are included.
- Empty lines = the order is not relevant.
- Use this to decide whether the Standard code should continue to apply the filter as normal.
- You might want to Piggyback on a standard filter OR Overrule it.
Step 5 - Handle each document event
There are four OnSetFilter-events for Receive.
icon | false |
---|
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.