Skip to main content

MobileOptionsProvider220FDW

Codeunit 73167914 — Manages the translated option values for filter dropdowns on the Home page. Exposes an integration event that lets you add custom options to any built-in filter type without modifying the platform.

OnRegisterFilterOptions

[IntegrationEvent(false, false)]
procedure OnRegisterFilterOptions(FilterType: Code[20]; var Options: JsonArray)

Subscribe to this event to inject additional options into any filter. Each option is a JsonObject with two keys:

KeyTypeDescription
labelTextDisplay text — use a Label variable so BC translates it via XLIFF
valueTextAPI token — use a Locked Label so it never changes

Example — adding a custom document type:

[EventSubscriber(ObjectType::Codeunit, Codeunit::MobileOptionsProvider220FDW, OnRegisterFilterOptions, '', false, false)]
local procedure AddMyDocType(FilterType: Code[20]; var Options: JsonArray)
var
OptionsProvider: Codeunit MobileOptionsProvider220FDW;
OptionObj: JsonObject;
MyDocTypeLbl: Label 'Transfer Order';
MyDocTypeTok: Label 'TransferOrder', Locked = true;
begin
if FilterType <> OptionsProvider.FilterTypeDocType() then exit;

OptionObj.Add('label', MyDocTypeLbl);
OptionObj.Add('value', MyDocTypeTok);
Options.Add(OptionObj);
end;
Register the label for translation

If you want the label translated in the mobile client's string map, also subscribe to MobileClientStrings220FDW.OnRegisterExtensionStrings and add the same label there so the #token replacement picks it up.


FilterType Constants

Use these methods to get the correct FilterType code when checking inside OnRegisterFilterOptions:

MethodReturnsBuilt-in options
FilterTypeType()'Type'Inbound, Internal, Outbound
FilterTypeAssignment()'Assignment'Assigned to Me, Unassigned, All
FilterTypeDocType()'DocType'Receipt, Put-Away, Pick, Movement
FilterTypeDateRange()'DateRange'All, Today

Built-in Option Tokens

These are the value tokens the platform already registers. Your AL service code receives the selected token via State.GetInput('filterDocType', false) (or the relevant filter key) and should match against these:

FilterTokenDisplay label
Type'Inbound'Inbound
Type'Internal'Internal
Type'Outbound'Outbound
Assignment'Assigned to Me'Assigned to Me
Assignment'Unassigned'Unassigned
Assignment'All'All
DocType'Receipt'Receipt
DocType'PutAway'Put-Away
DocType'Pick'Pick
DocType'Movement'Movement
DateRange'All'All
DateRange'Today'Today