Skip to main content

MobileNavigator220FDW

High-level navigation helper that builds navigation commands with proper page resolution, navigation data, and state serialization in a single call.

Overview

  • Object type: Codeunit
  • Object ID: 73167898
  • Access: Public
  • Namespace: Aptean.Mesh.SDUI

The navigator provides convenience methods that combine page code resolution, navigation data assembly, and command building into one call. It uses the MobilePage220FDW enum to identify targets and resolves page codes via the OnResolveTarget integration event.

var
Navigator: Codeunit MobileNavigator220FDW;
begin
// Navigate to a receipt detail screen
exit(Navigator.NavigateToDetail(State, MobilePage220FDW::Receipt, 'WH-REC-001'));
end;

Unlike MobileCommandBuilder220FDW which buffers commands for later serialization, the navigator methods call State.Serialize() internally and return the final response JsonObject directly.


MobilePage220FDW Enum

The MobilePage220FDW enum identifies mobile page targets. It is extensible, so custom pages can be added by extension apps.

ValueCaptionDescription
HomeHomeThe main home/dashboard screen
DetailDetailDocument detail view
ReceiptReceiptWarehouse receipt workflow
PutAwayPut AwayPut-away workflow
PickPickPick workflow
InventoryMovementInventory MovementInventory movement workflow
AdHocMovementAd-Hoc MovementAd-hoc movement workflow
BinContentsBinContentsBin contents inquiry
AdjustmentsAdjustmentsInventory adjustments
ScanEntryScanEntryGeneric scan entry screen

procedure NavigateToDetail(var State: Codeunit MobileRPCState220FDW; Target: Enum MobilePage220FDW; DocumentNo: Code[20]): JsonObject

Navigates to a document detail screen. Resolves the page code via OnResolveTarget, builds navigation data including the document number, title, and type, then serializes the response.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (passed by reference)
TargetEnum MobilePage220FDWThe target page type
DocumentNoCode[20]The document number to display

Returns: JsonObject -- the serialized RPC response.

The navigation data payload includes:

KeyDescription
documentNoThe document number
documentTitleResolved title (defaults to "<Target> <DocumentNo>")
documentTypeResolved type text (defaults to Format(Target))

Example:

local procedure HandleDocumentTap(var State: Codeunit MobileRPCState220FDW): JsonObject
var
Navigator: Codeunit MobileNavigator220FDW;
DocumentNo: Code[20];
begin
DocumentNo := State.GetInput('documentNo', true);
exit(Navigator.NavigateToDetail(State, MobilePage220FDW::Receipt, DocumentNo));
end;

procedure NavigateToWorkflow(var State: Codeunit MobileRPCState220FDW; Target: Enum MobilePage220FDW; DocumentNo: Code[20]; LineNo: Integer): JsonObject

Navigates to a workflow screen for a specific document line. Resolves the page code and builds navigation data with document number and line number.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (passed by reference)
TargetEnum MobilePage220FDWThe target page type
DocumentNoCode[20]The document number
LineNoIntegerThe line number to work on

Returns: JsonObject -- the serialized RPC response.


procedure NavigateToWorkflow(var State: Codeunit MobileRPCState220FDW; Target: Enum MobilePage220FDW; DocumentNo: Code[20]; LineNo: Integer; SelectedUOM: Code[10]): JsonObject

Navigates to a workflow screen with a pre-selected unit of measure.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (passed by reference)
TargetEnum MobilePage220FDWThe target page type
DocumentNoCode[20]The document number
LineNoIntegerThe line number to work on
SelectedUOMCode[10]The pre-selected unit of measure

Returns: JsonObject -- the serialized RPC response.

Example:

local procedure StartReceiptWorkflow(var State: Codeunit MobileRPCState220FDW): JsonObject
var
Navigator: Codeunit MobileNavigator220FDW;
begin
exit(Navigator.NavigateToWorkflow(
State,
MobilePage220FDW::Receipt,
'WH-REC-001',
10000,
'PCS'));
end;

procedure NavigateHome(var State: Codeunit MobileRPCState220FDW): JsonObject

Navigates to the home screen.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (passed by reference)

Returns: JsonObject -- the serialized RPC response.


procedure NavBackToHomeWithAlert(var State: Codeunit MobileRPCState220FDW; Title: Text; Message: Text): JsonObject

Pops the navigation stack back to the home screen and shows an alert dialog. Use this after completing a workflow to return the user to home with a success message.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (passed by reference)
TitleTextAlert dialog title
MessageTextAlert dialog message

Returns: JsonObject -- the serialized RPC response.

Example:

local procedure CompleteReceipt(var State: Codeunit MobileRPCState220FDW): JsonObject
var
Navigator: Codeunit MobileNavigator220FDW;
begin
// Post the receipt...
PostWarehouseReceipt(State.GetDocumentNo(true));

exit(Navigator.NavBackToHomeWithAlert(
State,
'Receipt Posted',
'Warehouse receipt WH-REC-001 has been posted successfully.'));
end;

Helper Methods

GetPageCode

procedure GetPageCode(Page: Enum MobilePage220FDW): Code[20]

Converts a MobilePage220FDW enum value to its uppercase page code string. For example, MobilePage220FDW::Receipt returns 'RECEIPT'.

Parameters:

NameTypeDescription
PageEnum MobilePage220FDWThe page enum value

Returns: Code[20] -- the uppercase page code.


GetMobilePage

procedure GetMobilePage(DocumentTypeText: Text): Enum MobilePage220FDW

Converts a document type text string back to a MobilePage220FDW enum value. Returns Home if no match is found.

Parameters:

NameTypeDescription
DocumentTypeTextTextThe document type text to look up

Returns: Enum MobilePage220FDW


BuildWorkflowNavigationData

procedure BuildWorkflowNavigationData(var State: Codeunit MobileRPCState220FDW; DocumentNo: Code[20]; LineNo: Integer): JsonObject

Builds the navigation data JSON for a workflow screen containing the document number and line number.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (for key name resolution)
DocumentNoCode[20]The document number
LineNoIntegerThe line number

Returns: JsonObject -- navigation data with documentNo and lineNo keys.


BuildWorkflowNavigationData (with UOM)

procedure BuildWorkflowNavigationData(var State: Codeunit MobileRPCState220FDW; DocumentNo: Code[20]; LineNo: Integer; SelectedUOM: Code[10]): JsonObject

Builds workflow navigation data including a pre-selected unit of measure.

Parameters:

NameTypeDescription
StateCodeunit MobileRPCState220FDWThe RPC state (for key name resolution)
DocumentNoCode[20]The document number
LineNoIntegerThe line number
SelectedUOMCode[10]The pre-selected UOM (omitted from JSON if empty)

Returns: JsonObject


OnResolveTarget Integration Event

[IntegrationEvent(false, false)]
local procedure OnResolveTarget(Target: Enum MobilePage220FDW; DocumentNo: Code[20]; var PageCode: Code[20]; var Title: Text; var TypeText: Text; var Handled: Boolean)

This integration event fires when the navigator resolves a target page. Subscribe to it to customize page codes, titles, or type text for specific document types.

Event parameters:

NameTypeDirectionDescription
TargetEnum MobilePage220FDWInThe requested target page
DocumentNoCode[20]InThe document number
PageCodeCode[20]OutSet this to override the page code
TitleTextOutSet this to override the navigation title
TypeTextTextOutSet this to override the document type text
HandledBooleanOutSet to true to indicate the event was handled

Subscriber example:

[EventSubscriber(ObjectType::Codeunit, Codeunit::MobileNavigator220FDW,
'OnResolveTarget', '', false, false)]
local procedure OnResolveTarget(
Target: Enum MobilePage220FDW;
DocumentNo: Code[20];
var PageCode: Code[20];
var Title: Text;
var TypeText: Text;
var Handled: Boolean)
var
WhseRecHeader: Record "Warehouse Receipt Header";
begin
if Target <> MobilePage220FDW::Receipt then
exit;

if WhseRecHeader.Get(DocumentNo) then begin
PageCode := 'RECEIPT';
Title := StrSubstNo('Receipt %1 - %2', DocumentNo, WhseRecHeader."Vendor No.");
TypeText := 'Receipt';
Handled := true;
end;
end;

When Handled is false, the navigator falls back to default resolution:

  • PageCode is derived from GetPageCode(Target) (uppercase enum caption)
  • Title is set to "<Target> <DocumentNo>"
  • TypeText is set to Format(Target)

See Also