Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Typo

Description

Excerpt

"onlineValidation" can be enabled for Steps to instantly verify the user-entered dataon Steps can instantly validate the entered data, with a call to the back-end

To reject the inputted data, write code to throw an Error.

See Online validation for more background on this feature.

Limitations

  • Online Validation limits the Offline capabilities of the system
  • Online validation is currently not logged in the Document Queue and can and cannot be debugged in this way



Example

    // 
    // Step 1 of 4
    // 
    // Create setup "Mobile Document Type"
    // * Request Document Type = 'MyValidateNoDecimals'
    // * Processing Codeunt = Codeunit::"MOB WMS Whse. Inquiry" (6181379)


    // 
    // Step 2 of 4
    // 
    // Add the "WMS" Mobile Group to this new Document type.

    // 
    // Step 3 of 4
    // 
    // Subscriber 1: Enable onlineValidation for Length/Width/Height Steps from the 'ItemDimensions' Adhoc Document Type
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfiguration_OnAfterAddStep''', true, true)]
    procedure OnGetRegistrationConfiguration_OnAfterAddStep(_RegistrationType: Textvar _HeaderFieldValues: Record "MOB NS Request Element"; var _Step: Record "MOB Steps Element")
    var
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
    begin
        if _RegistrationType <> MobWmsToolbox."CONST::ItemDimensions"() then
            exit;

        if _Step.Get_name() in ['Length''Width''Height'then
            _Step.Set_onlineValidation('MyValidateNoDecimals');
    end;

    // 
    // Step 4 of 4
    //
    // Subscriber 2: Implement DocumentType 'ValidateNoDecimals' in the "MOB WMS Whse. Inquiry" codeunit
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentTypeAsXml''', true, true)]
    procedure MyOnWhseInquiryOnCustomDocumentTypeAsXml(_DocumentType: Textvar _XMLRequestDoc: XmlDocumentvar _XMLResponseDoc: XmlDocumentvar _IsHandled: Boolean)
    var
        RequestValues: Record "MOB NS Request Element" temporary;
        MobToolbox: Codeunit "MOB Toolbox";
        RequestMgt: Codeunit "MOB NS Request Management";
    begin
        if (_DocumentType <> 'MyValidateNoDecimals') or _IsHandled then
            exit;

        // Validate no decimals in Length, Width or Height
        RequestMgt.SaveAdhocFilters(_XMLRequestDoc, RequestValues);

        ErrorIfDecimals(RequestValues.GetValueAsDecimal('Length'));
        ErrorIfDecimals(RequestValues.GetValueAsDecimal('Width'));
        ErrorIfDecimals(RequestValues.GetValueAsDecimal('Height'));

        MobToolbox.CreateSimpleResponse(_XmlResponseDoc, 'OK');
        _IsHandled := true;
    end;

    local procedure ErrorIfDecimals(_DecimalValue: Decimal)
    begin
        if _DecimalValue <> ROUND(_DecimalValue, 1then
            Error('Value can have no decimals.');
    end;


Version History

VersionChanges
MOB5.16Introduced

...