Label Printing Extensibility
Aptean Mesh provides a built-in label printing pipeline that fires automatically after warehouse receipt posting. You can replace or augment the built-in Aptean Labeling adapter with any third-party or custom solution by implementing the IMobileLabelProvider220FDW interface.
Overview
- Interface:
IMobileLabelProvider220FDW - Enum:
LabelProviderType220FDW(extensible) - Management codeunit:
MobileLabelMgt220FDW - Namespace:
Aptean.Mesh.Services
The framework resolves the active label provider from Mobile Setup."Label Provider" and dispatches print requests to it via a background StartSession() call. This means label printing never blocks the foreground RPC response.
Print Flow
- Taps Print
- or receipt is posted
The foreground RPC handler calls MobileLabelMgt220FDW.PrintReceiptLabel() or PrintBinLotLabel(). Each method:
- Builds a
MobileLabelRequest220FDWtemporary record with all the document and item data - Calls
StartSession(SessionId, Codeunit::MobileLabelMgt220FDW, CompanyName(), LabelRequest) - The background session runs
MobileLabelMgt220FDW.OnRun(), which resolves the provider fromMobile Setup."Label Provider"and callsPrintLabel(LabelRequest)
IMobileLabelProvider220FDW
interface IMobileLabelProvider220FDW
{
procedure PrintLabel(var LabelRequest: Record MobileLabelRequest220FDW);
}
The single method receives a fully populated MobileLabelRequest220FDW temporary record. Your implementation should read the fields it needs and submit a print job to your labeling system.
LabelProviderType220FDW
enum 73167875 LabelProviderType220FDW implements IMobileLabelProvider220FDW
{
Extensible = true;
value(0; "Aptean Labeling")
{
Caption = 'Aptean Labeling';
Implementation = IMobileLabelProvider220FDW = FBLabelingAdapter220FDW;
}
}
Extend this enum to register your custom provider:
enumextension 50100 MyLabelProviderExt extends LabelProviderType220FDW
{
value(1; "My Label System")
{
Caption = 'My Label System';
Implementation = IMobileLabelProvider220FDW = MyLabelAdapter;
}
}
After deploying the extension, select My Label System in Mobile Setup > Label Provider.
MobileLabelRequest220FDW
Table 73167882 -- Temporary table passed to PrintLabel() in the background session.
- Table Type: Temporary
- Data Classification: SystemMetadata
Fields
| No. | Name | Type | Description |
|---|---|---|---|
| 1 | Entry No. | Integer | Unique identifier for this label request entry. |
| 2 | Document Type | Integer | Source document type (e.g., Database::"Purchase Line"). |
| 3 | Document No. | Code[20] | Source document number (e.g., purchase order number). |
| 4 | Document Line No. | Integer | Line number on the source document. |
| 5 | Source Type | Enum SourceTypeCustomLabelFDW | Type of the source party: Vendor, Customer, or None. |
| 6 | Source No. | Code[20] | Vendor or customer number from the source document. |
| 7 | Item No. | Code[20] | Item number to be labelled. |
| 8 | Description | Text[100] | Item description, captured from the warehouse receipt line. |
| 9 | Variant Code | Code[10] | Item variant code. |
| 10 | Location Code | Code[10] | Warehouse location where the item is stored. |
| 11 | Bin Code | Code[20] | Bin within the warehouse location. |
| 12 | Lot No. | Code[50] | Lot number. When populated, a lot tag label is printed instead of a receiving label. |
| 13 | Expiration Date | Date | Lot expiration date. |
| 14 | Quantity (Base) | Decimal | Total quantity for the item or lot in the base unit of measure. |
| 15 | No. of Labels | Integer | Number of label copies to print. |
Keys
| Name | Fields | Properties |
|---|---|---|
| PK | Entry No. | Clustered |
MobileLabelMgt220FDW
The internal management codeunit. Call its methods from your RPC handlers to trigger label printing. Do not call OnRun() directly -- it runs in the background session.
PrintReceiptLabel
internal procedure PrintReceiptLabel(
ScanEntry: Record "Mobile Scan Entry 220FDW";
WhseReceiptLine: Record "Warehouse Receipt Line";
NoOfLabels: Integer)
Builds a label request from a scan entry and warehouse receipt line, then dispatches to the background session. The method resolves the vendor/customer number from the source purchase or sales header and populates Source Type and Source No. automatically.
| Parameter | Description |
|---|---|
ScanEntry | The completed scan entry containing Lot No., Expiration Date, and Quantity (Base). |
WhseReceiptLine | The posted warehouse receipt line providing document and item context. |
NoOfLabels | Number of copies. Pass 0 to use the value already set in the request (or the default). |
PrintBinLotLabel
internal procedure PrintBinLotLabel(
ItemNo: Code[20];
VariantCode: Code[10];
LocationCode: Code[10];
BinCode: Code[20];
LotNo: Code[50];
NoOfLabels: Integer)
Builds a lot tag label request from warehouse location data. Looks up the lot's current inventory and expiration date automatically. Raises an error if the lot does not exist in Lot No. Information.
GetNoOfLabelsKey
internal procedure GetNoOfLabelsKey(): Text
Returns the workflow state key 'noOfLabels' used to store the user-entered label count. Use this key when reading from State.GetWorkflowText() in your step handler:
NoOfLabels := State.GetWorkflowInteger(LabelMgt.GetNoOfLabelsKey(), false);
Mobile Setup Configuration
Label printing is configured on the Mobile Setup page:
| Field | Type | Description |
|---|---|---|
Auto-Print Labels | Boolean | When enabled, PrintReceiptLabel() is called automatically after posting a warehouse receipt. |
Label Provider | Enum LabelProviderType220FDW | The active label provider. Only visible when Auto-Print Labels is enabled. |
Auto-Print Flow
When Auto-Print Labels is enabled, the receipt posting logic calls MobileLabelMgt220FDW.PrintReceiptLabel() for each posted line. No code changes are needed -- the built-in receipt service handles this automatically.
On-Demand Print (RPC)
To allow users to re-print labels from an RPC action:
local procedure HandlePrintLabel(var State: Codeunit MobileRPCState220FDW)
var
LabelMgt: Codeunit MobileLabelMgt220FDW;
ScanEntry: Record "Mobile Scan Entry 220FDW";
WhseReceiptLine: Record "Warehouse Receipt Line";
NoOfLabels: Integer;
begin
// Read the quantity from workflow state (user entered it in a prior step)
NoOfLabels := State.GetWorkflowInteger(LabelMgt.GetNoOfLabelsKey(), false);
if NoOfLabels <= 0 then
NoOfLabels := 1;
// Load the source records
ScanEntry.Get(State.GetWorkflowInteger('scanEntryNo', true));
WhseReceiptLine.Get(
State.GetWorkflowText('receiptNo', true),
State.GetWorkflowInteger('receiptLineNo', true));
LabelMgt.PrintReceiptLabel(ScanEntry, WhseReceiptLine, NoOfLabels);
State.Command()
.VibrateSuccess()
.Alert(LabelMgt.GetPrintLabelTitle(),
LabelMgt.GetLabelsPrintedMessage(NoOfLabels));
end;
Implementing a Custom Provider
codeunit 50101 MyLabelAdapter implements IMobileLabelProvider220FDW
{
procedure PrintLabel(var LabelRequest: Record MobileLabelRequest220FDW)
var
MyPrintClient: Codeunit MyPrintSystemClient;
begin
// Map MobileLabelRequest fields to your print system's API
MyPrintClient.Submit(
LabelRequest."Item No.",
LabelRequest."Lot No.",
LabelRequest."Location Code",
LabelRequest."Bin Code",
LabelRequest."No. of Labels"
);
end;
}
The codeunit runs inside a background StartSession() -- it has no access to the calling session's state. Errors raised inside PrintLabel() are logged to the BC event log but do not surface to the mobile user. Implement your own error notification (e.g., a notification or log entry) if you need visibility into failures.
See Also
- Tables --
MobileLabelRequest220FDWfull field reference - MobileItemMgt220FDW -- item tracking helpers used in receipt workflows
- IStepHandler220FDW -- workflow step interface for receipt scan flows