Custom form fields

Shop Floor Production  •  Article  •  10/21/2026  • 

Custom form fields allow you to add custom fields to Shop Floor Production's registration screens via a per-tenant extension (PTE). This lets customers and partners define fields that users must populate during the production registration process, entirely in AL.

Supported screens

Custom form fields can be added to the following screens:

  • Register Input
  • Register Output

Read-only custom fields can also be shown on the following correction screens:

  • Correct Consumption
  • Correct Output

Standard fields on all four screens can also be hidden. For more information, see Hide standard form fields.

Registering custom form elements

Custom form elements are registered through one of two events:

SFPBCGetFormElements14FDW.Codeunit.al

[IntegrationEvent(false, false)]
local procedure OnAddCustomFormElementsForConsumption(var TempCustomFormElements: Record TempCustomFormElements14FDW temporary; var CustomFormFields: Dictionary of [Text, Text]; ProdOrderComponent: Record "Prod. Order Component")
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAddCustomFormElementsForOutput(var TempCustomFormElements: Record TempCustomFormElements14FDW temporary; ProdOrderRoutingLine: Record "Prod. Order Routing Line")
begin
end;

The CustomFormFields parameter on OnAddCustomFormElementsForConsumption carries any values already pre-populated by custom consumption scan logic. If a value is present for your field's key, pass it to SetDefaultValue so the scanned value carries through onto the rendered field.

Read-only fields can be registered on the correction screens through these two events:

SFPBCGetFormElements14FDW.Codeunit.al

[IntegrationEvent(false, false)]
local procedure OnGetConsumptionCorrectionCustomFields(ItemLedgerEntry: Record "Item Ledger Entry"; var CustomFields: Record TempCustomFormElements14FDW temporary)
begin
end;

[IntegrationEvent(false, false)]
local procedure OnGetOutputCorrectionCustomFields(ItemLedgerEntry: Record "Item Ledger Entry"; ProductionOrderLine: Record "Prod. Order Line"; var CustomFields: Record TempCustomFormElements14FDW temporary)
begin
end;

TempCustomFormElements record

All of the events above pass a TempCustomFormElements14FDW temporary record. This table stores the definition of every custom field and is parsed and returned to the React frontend so it can render the fields on screen.

Helper functions

FunctionDescription
AddNewCustomFormElement(FieldKey, FieldName, ElementType, RequiredValue, VisibleValue, IsInvalidValue)Initializes a new custom form element. FieldKey is a unique camelCase identifier; FieldName is the label shown in the app.
SetDefaultValueSets the default value for the current custom form element (text or date).
SetNumberMinValue / SetNumberMaxValueSets the minimum/maximum acceptable value for a numeric field.
SetNumberMaxDecimalPlacesSets the maximum number of decimal places accepted for a numeric field.
SetTextAreaRowsAndMaxLengthSets the number of rows and maximum length for a text area field.
AddSelectOptionAdds a selectable option to a select field.
AddCustomFormElementErrorValidationAdds a custom validation error message for the field.

ElementType (FormElementTypes14FDW)

FormElementTypes14FDW defines the supported field types:

  • Text — text field input
  • Number — text field input formatted to only accept numbers
  • Date — date picker input
  • Select — select box with multiple options
  • TextArea — large text field input
  • ReadOnly — read-only field that cannot be modified
  • Boolean — Yes/No field

Example: defining custom form elements

The following example defines a required text field and a select field on the Register Output screen:

[EventSubscriber(ObjectType::Codeunit, Codeunit::SFPBCGetFormElements14FDW, OnAddCustomFormElementsForOutput, '', false, false)]
local procedure AddCustomFormElementsForOutput(var TempCustomFormElements: Record TempCustomFormElements14FDW temporary)
begin
    TempCustomFormElements.AddNewCustomFormElement('caseNo', 'Case No.', FormElementTypes14FDW::Text, true, true, false);

    TempCustomFormElements.AddNewCustomFormElement('shift', 'Shift', FormElementTypes14FDW::Select, false, true, false);
    TempCustomFormElements.AddSelectOption('1', 'First shift');
    TempCustomFormElements.AddSelectOption('2', 'Second shift');
end;

Custom field validation

Custom fields can be validated using one of the two events defined in SFPBCProductionReg14FDW.Codeunit.al:

  • OnValidateCustomFormElementsForConsumption
  • OnValidateCustomFormElementsForOutput

Both events pass the TempCustomFormElements record. Use the FieldKey you defined earlier to find the correct record; the Field Value field holds the user-entered value.

These events run after the frontend's own checks — a field registered with RequiredValue = true on AddNewCustomFormElement already blocks submission of a blank value, so validation here doesn't need to re-check for a value being present. Use it for rules the frontend can't enforce on its own, such as format or business-rule checks.

[EventSubscriber(ObjectType::Codeunit, Codeunit::SFPBCProductionReg14FDW, OnValidateCustomFormElementsForOutput, '', false, false)]
local procedure ValidateCustomFormElementsForOutput(var TempCustomFormElements: Record TempCustomFormElements14FDW)
var
    CaseNoLengthErr: Label 'Case No. must be exactly 6 characters.';
begin
    if not TempCustomFormElements.Get('caseNo') then
        exit;

    if StrLen(TempCustomFormElements."Field Value") <> 6 then
        TempCustomFormElements.AddCustomFormElementErrorValidation('caseNo', CaseNoLengthErr);
end;

Custom field logic

Finally, define what to do with the values entered into custom fields through the OnAfterPostProductionRegistration event. This event passes the TempCustomFormElements table along with the Item Ledger Entry number generated by the registration posting.

  • ItemLedgerEntryNo is 0 in two situations, and the event is raised in both. Always test for 0 before using the value, as in the example below.
  • The registration failed. The event is raised whether or not the posting succeeded, and 0 is how a failed posting is reported. Do not treat the event as confirmation that anything was posted.
  • No Item Ledger Entry was created. Output registered on a routing operation that is not the last operation of the routing produces only a Capacity Ledger Entry, so there is no Item Ledger Entry to write to. If you need to store a custom value against intermediate operations, write it to your own table keyed on the production order, line, and operation instead of to the Item Ledger Entry.
[EventSubscriber(ObjectType::Codeunit, Codeunit::SFPBCProductionReg14FDW, OnAfterPostProductionRegistration, '', false, false)]
local procedure OnAfterPostProductionRegistration(var TempCustomFormElements: Record TempCustomFormElements14FDW; ItemLedgerEntryNo: Integer)
var
    ItemLedgerEntry: Record "Item Ledger Entry";
begin
    if ItemLedgerEntryNo = 0 then
        exit;

    ItemLedgerEntry.Get(ItemLedgerEntryNo);

    if TempCustomFormElements.Get('caseNo') then begin
        // "Case No." is assumed here to be a custom field added to Item Ledger Entry via a table extension
        ItemLedgerEntry."Case No." := TempCustomFormElements."Field Value";
        ItemLedgerEntry.Modify();
    end;
end;

Hide standard form fields

A PTE can hide standard fields on the Register Input, Register Output, Correct Consumption, and Correct Output screens, such as the Shipping Container field on the Register Output screen.

Hiding a standard field changes what operators see, not what a registration needs. The validation and posting rules for a hidden field still apply, and Shop Floor Production does not check whether the fields that remain visible are enough to complete a registration correctly. Avoid hiding fields that a registration depends on, such as the quantity, lot, license plate, bin, or weight fields, and test every affected registration and correction screen with the items, item tracking, and setups used in production before deploying the PTE.

Subscribe to the OnAfterGetFormElements event, which is raised once each time one of these screens is built, after the standard fields are added:

SFPBCGetFormElements14FDW.Codeunit.al

[IntegrationEvent(false, false)]
local procedure OnAfterGetFormElements(FormType: Text; ProductionOrderNo: Code[20]; ProductionOrderLineNo: Integer; RoutingReferenceNo: Integer; ComponentLineNo: Integer; ItemNo: Code[20]; WorkCenterNo: Code[20]; RoutingNo: Code[20]; OperationNo: Code[10]; ItemLedgerEntryNo: Integer; var TempFormElementOverride: Record TempFormElementOverride14FDW temporary)
begin
end;

The FormType parameter identifies the screen:

FormType valueScreen
consumptionRegister Input
consumption-correctionCorrect Consumption
outputRegister Output
output-correctionCorrect Output

The other parameters identify the production order, line, component, item, work center, routing operation, or item ledger entry that the screen was opened for.

To hide a field, call SetVisible(FieldKey, false) on the TempFormElementOverride record. The TempFormElementOverride14FDW temporary table has the following fields:

FieldDescription
Field KeySpecifies the field key of the standard field to change.
PropertySpecifies the field property to change. The only option is Visible.
Boolean ValueSpecifies the new value of the property.

The following field keys are available:

ScreenField keys
Register Inputitem, variantCode, lotNo, comment, inventory, expirationDate, quantity, binCode, weight, tareWeight, licensePlateNo, weightQty
Register OutputitemNo, lotNo, licensePlateNo, expirationDate, lotProductionDate, shippingContainer, binCode, quantity, weight, tareWeight, weightQty, scrapQty, printLabel, comment
Correct ConsumptionquantityToCorrect, weightQuantityToCorrect, leftOverQuantity, toLicensePlate, binCode, comment
Correct OutputquantityToCorrect, weightQuantityToCorrect, comment
  • The field key must match one of the keys in the table above exactly. A key that does not match a field on the screen is ignored.
  • Only the visibility of the field changes. Other field properties, such as whether the field is required, do not change.
  • The event is also raised when a subscriber to the OnBeforeProcessFormType event builds the screen, so the same settings apply to custom-built screens.

The following example hides the Shipping Container field on the Register Output screen for all production orders:

[EventSubscriber(ObjectType::Codeunit, Codeunit::SFPBCGetFormElements14FDW, OnAfterGetFormElements, '', false, false)]
local procedure HideShippingContainerOnOutput(FormType: Text; var TempFormElementOverride: Record TempFormElementOverride14FDW temporary)
begin
    if FormType <> 'output' then
        exit;

    TempFormElementOverride.SetVisible('shippingContainer', false);
end;