OnGetReferenceData_OnAfterAddHeaderField

Use this event to

Modify a single HeaderField, typically standard fields.


Description

This event is executed once for every HeaderField added from standard HeaderConfigurations as well as custom HeaderConfigurations.

You may use this event to change any property of the HeaderField or hide the HeaderField.


See also: OnGetReferenceData_OnAddHeaderConfigurations


Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterAddHeaderField''', true, true)]
    local procedure OnGetReferenceData_OnAfterAddHeaderField(var _Headerfield: Record "MOB HeaderField Element")
    begin
    end;


Example 1: Hide a single field from ReceiveOrderFilters

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterAddHeaderField''', true, true)]
    local procedure MyOnGetReferenceData_OnAfterAddHeaderField(var _HeaderField: Record "MOB HeaderField Element")
    begin
        // Hide a single field from ReceiveOrderFilters
        if (_HeaderField.ConfigurationKey = 'ReceiveOrderFilters') and (_HeaderField.Get_name() 'PurchaseOrderNumber'then
            _HeaderField.Set_visible(false);


        // Globally change a specific label for all fields (this exact caption is not implemented via MOB WMS Translations)
        if _HeaderField.Get_label() 'Assigned User ID:' then
            _HeaderField.Set_label('Assigned to:');
    end;


Example 2: Set a default value for Expected Receipt Date on ReceiveOrderFilters

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAfterAddHeaderField', '', true, true)]
    local procedure My02OnGetReferenceData_OnAfterAddHeaderField(var _HeaderField: Record "MOB HeaderField Element")
    begin

        // [Example] Set a default value for Expected Receipt Date on ReceiveOrderFilters
        if (_HeaderField.ConfigurationKey = 'ReceiveOrderFilters') and (_HeaderField.Get_name() = 'Date') then
            _HeaderField.Set_defaultValue(CalcDate('<+30D>', Today)); // +30 days from today
    end;



More examples

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


Version History

VersionChanges
MOB5.14Introduced
MOB5.45New date-overload for Set_defaultValue introduced.