Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use this event to

...

You can use Whse. Inquiry to perform instant Online validationValidation of a steps input value. 

...

You must call Error() when validation should fail.



Template

    // [Template]

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentType''', true, true)]
    local procedure OnWhseInquiryOnCustomDocumentType(_DocumentType: Textvar _RequestValues: Record "MOB NS Request Element"; var _RegistrationTypeTrackingResponseElementTextRecord "MOB NS Resp Element"var _ResponseElementRegistrationTypeTrackingRecord "MOB NS Resp Element"Textvar _IsHandled: Boolean)
    begin
    end;

Example

...

Example

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentType''', true, true)]
    local procedure Ex01OnWhseInquiryOnCustomDocumentType(_DocumentType: Textvar _RequestValues: Record "MOB NS Request Element"; var _RegistrationTypeTrackingResponseElement: Record Text"MOB NS Resp Element"var _ResponseElementRegistrationTypeTrackingRecord "MOB NS Resp Element"Textvar _IsHandled: Boolean)
    var
        ItemLedgerEntry: Record "Item Ledger Entry";
        SerialNumber: Text;
    begin

        // Make sure we only handle the Serial No. validation
        if _DocumentType <> 'GetSerialNumberInformation' then
            exit;

        // Read request
        SerialNumber := _RequestValues.GetValue('SerialNumber', true);

        if SerialNumber = '' then
            exit;

        // Serial number must be available in the Item Ledger Entries
        ItemLedgerEntry.Reset();
        ItemLedgerEntry.SetCurrentKey("Serial No.");
        ItemLedgerEntry.SetRange("Serial No.", SerialNumber);
        ItemLedgerEntry.SetRange(Open, true);
        ItemLedgerEntry.SetRange(Positive, true);

        if not ItemLedgerEntry.CountIsEmpty() 1 then begin
            exit  // -- The Serial number is available
            // Respond with Item Number
            if ItemLedgerEntry.FindFirst() then
                exit;
        end else
                    else
            Error('Unknown serial no. "%1"', SerialNumber)// -- Not found
            Error('Unknown serial no.');

        _RegistrationTypeTracking := SerialNumber;

        // Event is now handled
        _IsHandled := true;
    end;



Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
titleMore examples
excerptTypesimple
cqllabel = "bc" and label = "example" and label = "onwhseinquiryoncustomdocumenttypeasxml"

...