OnGetReferenceData_OnAddHeaderConfigurations
Use this event to
Create custom header-fields - or add header-fields to existing headers.
Description
Headers are static data in Reference Data, meaning they are loaded on login and cannot change dynamically.
ConfigurationKeys holds header-fields and can be can be added, using "Create
"-methods:
HeaderConfigurationElement.Create(...)
will initialize a ConfigurationKey- "
Create_...Field
"-methods will take a few, mandatory arguments - "
Create_...Field
"-methods usually will offer an alternative argument list (other signature) that includes mandatory arguments as well as most commonly used optional arguments - Optional values can also be set subsequently using a number of related "
Set_
"-methods
See also: OnGetReferenceData_OnAfterAddHeaderField
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
local procedure OnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
begin
end;
Example 1
// [Example] 01 - Create new custom ConfigurationKey
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
local procedure My01OnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
begin
_HeaderFields.InitConfigurationKey('MyNewConfigurationKey'); // Identifier for new ConfigurationKey - replace by your own key name
// Add headerConfiguration elements here
// ...
// _HeaderFields.Create_TextField(...);
// _HeaderFields.Set_...;
// _HeaderFields.Set_...;
//
// _HeaderFields.Create_IntegerField(...);
// _HeaderFields.Set_...;
// _HeaderFields.Set_...;
end;
Example 2
// [Example] 02 - Add field to existing ConfigurationKey from standard Mobile WMS
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
local procedure My02OnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
begin
// Add a field to an existing ConfigurationKey from standard Mobile WMS
_HeaderFields.InitConfigurationKey('ReceiveOrderFilters');
// Use existing template 'ItemNumber' to add field, rather than Create_TextField(...)
// Id 15 = display between Location and Date (Id's 10 and 20)
_HeaderFields.Create_TextField_ItemNumber(15);
end;
Example 3
// [Example] 03 - Add new 'CustomPrintLabel' key with steps for collecting information needed to print a label
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
local procedure My03OnGetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
var
MobToolbox: Codeunit "MOB Toolbox";
MobWmsLanguage: Codeunit "MOB WMS Language";
begin
//
// Identifier for new ConfigurationKey - replace by your own key name
//
_HeaderFields.InitConfigurationKey('CustomPrintLabel');
//
// Add headerConfiguration elements here
//
// ItemNumber
_HeaderFields.Create_TextField(1, 'ItemNumber');
_HeaderFields.Set_label(MobWmsLanguage.GetMessage('ITEM') + ':');
_HeaderFields.Set_clearOnClear(true);
_HeaderFields.Set_acceptBarcode(true);
_HeaderFields.Set_length(20);
_HeaderFields.Set_searchType('ItemSearch');
_HeaderFields.Set_eanAi(MobToolbox.GetItemNoGS1Ai());
// LotNumber
_HeaderFields.Create_TextField(2, 'LotNumber');
_HeaderFields.Set_label(MobWmsLanguage.GetMessage('LOT_NO_LABEL') + ':');
_HeaderFields.Set_clearOnClear(true);
_HeaderFields.Set_acceptBarcode(true);
_HeaderFields.Set_length(20);
_HeaderFields.Set_eanAi(MobToolbox.GetLotNoGS1Ai());
// ExpirationDate
_HeaderFields.Create_DateField(3, 'ExpirationDate');
_HeaderFields.Set_label(MobWmsLanguage.GetMessage('EXP_DATE_LABEL') + ':');
_HeaderFields.Set_clearOnClear(false);
_HeaderFields.Set_acceptBarcode(true);
_HeaderFields.Set_eanAi(MobToolbox.GetExpirationDateGS1Ai());
// Quantity
_HeaderFields.Create_IntegerField(4, 'Quantity');
_HeaderFields.Set_label(MobWmsLanguage.GetMessage('QUANTITY') + ':');
_HeaderFields.Set_clearOnClear(true);
_HeaderFields.Set_acceptBarcode(true);
_HeaderFields.Set_minValue(0);
_HeaderFields.Set_eanAi(MobToolbox.GetQuantityGS1Ai());
// NumberOfLabels
_HeaderFields.Create_IntegerField(5, 'NumberOfLabels');
_HeaderFields.Set_label(MobWmsLanguage.GetMessage('PRINT_QTY') + ':');
_HeaderFields.Set_clearOnClear(true);
_HeaderFields.Set_acceptBarcode(false);
_HeaderFields.Set_minValue(0);
_HeaderFields.Set_maxValue(5);
end;
More examples
-
Case: Filter Bin Content for specific Serial No. — Filter Lookup Bin Content for a specific Serial No.
-
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.
-
Case: Filter Receipts based on Comments — The user wants to filter Receipts on whether they have comments or not
-
How-to: Add action to Order Line menu — Add a new Unplanned Function as action on Pick Lines.
-
How-to: Create custom Lookup Function — Adding a new custom Lookup function with one "Header field" to show simple lookup response.
-
How-to: Create custom Unplanned function in Main Menu — The most common control for customization
Add a new function to the Main menu. "Header fields" and optional "Steps" to collect
-
How-to: Create header — How to create a new Header for Planned Functions for filtering order/documents.
-
How-to: Modify header — Modify headers. Filter (planned function Orders and Lookups) or input data (unplanned functions).
Version History
Version | Changes |
---|---|
MOB5.00 | Introduced as OnGetReferenceData_OnAfterCreateHeaderConfigurations |
MOB5.14 | Refactored (renamed and new parameters) |