OnSearchOnAnySearchType_OnAfterSetCurrentKey

Use this event to

Change sort order for <SearchResponse>-elements at the mobile device.


See also: How-to: Sorting of Orders (OnAfterSetFrom-events)

Template

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnAnySearchType_OnAfterSetCurrentKey', '', true, true)]
    local procedure OnSearchOnAnySearchType_OnAfterSetCurrentKey(_SearchType: Text; var _SearchResponseElementView: Record "MOB NS SearchResult Element")
    begin
    end;

Example

    // [Example]  Sort ItemSearch response by Item.Name (="DisplayLine2" in response)
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Online Search", 'OnSearchOnAnySearchType_OnAfterSetCurrentKey', '', true, true)]
    local procedure MyOnSearchOnAnySearchType_OnAfterSetCurrentKey(_SearchType: Text; var _SearchResponseElementView: Record "MOB NS SearchResult Element")
    begin
        if _SearchType = 'ItemSearch' then
            _SearchResponseElementView.SetCurrentKey(DisplayLine2); // DisplayLine2 is Item.Name in ItemSearch reponse
    end;

Version History

VersionChanges
MOB5.43Introduced