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 2 Current »

Description

The API event parameters does not include all the information you want  

Use case

This work-around will allow you to read the current mobile request

Step 1 : Adding custom header filter

Using OnGetReferenceData_OnAddHeaderConfigurations  a Header Field called MyFilter is added

  

[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Reference Data", 'OnGetReferenceData_OnAddHeaderConfigurations', '', true, true)]
local procedure GetReferenceData_OnAddHeaderConfigurations(var _HeaderFields: Record "MOB HeaderField Element")
begin
        // Header keys can be found by inspecting the GetReferenceData response that happens with every mobile login
        _HeaderFields.InitConfigurationKey('PickOrderFilters');        
        _HeaderFields.Create_TextField(15, 'MyFilter', 'My filter:');
end;


Step 2 : Reading the filter from event 

The event OnGetPickOrders_OnIncludeWarehouseActivityHeader does not includs header-filters.

  • Using the Document Queue we retrieve the entire current XML Request
  • Now we can use the familiar "GetValue"-function to retrieve the MyFilter filter-value


[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnGetPickOrders_OnIncludeWarehouseActivityHeader', '', true, true)]

    local procedure OnGetPickOrders_OnIncludeWarehouseActivityHeader(_WhseActHeader: Record "Warehouse Activity Header"; var _IncludeInOrderList: Boolean)
    var
        MobDocQueue: Record "MOB Document Queue";
        TempHeaderFilter: Record "MOB NS Request Element" temporary;
        MobSessionData: Codeunit "MOB SessionData";
        MobRequestMgt: Codeunit "MOB NS Request Management";
        XMLRequestDoc: XmlDocument;
    begin
        MobDocQueue.GetByGuid(MobSessionData.GetPostingMessageId(), MobDocQueue);
        MobDocQueue.LoadXMLRequestDoc(XMLRequestDoc);
        MobRequestMgt.SaveHeaderFilters(XmlRequestDoc, TempHeaderFilter);

        error('%1', TempHeaderFilter.GetValue('MyFilter')); // This will display "MyFilter" on mobile device
    end;

See also 


  • No labels