Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Use this event to

Handle existing or new 'Whse. Inquiry' document types.

Description

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

Use this event to overwrite existing behavior or handle new custom types.



Template

    // [Template]
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentType''', true, true)]
    local procedure OnWhseInquiryOnCustomDocumentType(_DocumentType: Textvar _RequestValues: Record "MOB NS Request Element"; var _RegistrationTypeTracking: Textvar _ResponseElement: Record "MOB NS Resp Element"; var _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 _RegistrationTypeTracking: Textvar _ResponseElement: Record "MOB NS Resp Element"; var _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');

        // 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 ItemLedgerEntry.Count() 1 then begin
            // -- The Serial number is available

            // Respond with Item Number
            if ItemLedgerEntry.FindFirst() then
                exit;

        end else
            // -- Not found
            Error('Unknown serial no.');

        _RegistrationTypeTracking := SerialNumber;

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



More examples


Version History

VersionChanges
MOB5.24Introduced
  • No labels