Versions Compared

Key

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

Use this event to

Excerpt

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

Description

Optionally use this event to handle new custom Document Types in the 'Whse. Inquiry' document handler class.

You may handle new custom Document Types for Whse. Inquiry either by:

...

Both courses of action are valid, and your choice may be dependent on how old code is structured when doing migrations from older MOB versions.

Template

    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.


Implicit success

If you do nothing, the validation is considered successful by the mobile device. 

You must call Error() when validation should fail.



Template

    // [Template]

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentTypeAsXmlOnWhseInquiryOnCustomDocumentType''', true, true)]
    local procedure OnWhseInquiryOnCustomDocumentTypeAsXml OnWhseInquiryOnCustomDocumentType(var _XMLRequestDocDocumentTypeXmlDocumentTextvar _XMLResponseDocRequestValues: Record XmlDocument"MOB NS Request Element"var _DocumentTypeResponseElement: Record Text"MOB NS Resp Element"var _RegistrationTypeTracking: Text[200]var _IsHandled: Boolean)
    begin
    end;

Example

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Whse. Inquiry", 'OnWhseInquiryOnCustomDocumentTypeAsXmlOnWhseInquiryOnCustomDocumentType''', true, true)]
    local procedure OnWhseInquiryOnCustomDocumentTypeAsXml Ex01OnWhseInquiryOnCustomDocumentType(var _XMLRequestDocDocumentTypeXmlDocumentTextvar _XMLResponseDocRequestValues: Record XmlDocument"MOB NS Request Element"var _DocumentTypeResponseElement: Record Text"MOB NS Resp Element"var _RegistrationTypeTracking: Text[200]var _IsHandled: Boolean)
    var
        ItemLedgerEntry: Record "Item Ledger Entry";
        SerialNumber: Text;
    begin

        // Make sure we only handle the Serial No. validation
        if (_DocumentType <> 'MyCustomWhseInquiryDocumentTypeGetSerialNumberInformation') or _IsHandled then
            exit;

        // Read request
        SerialNumber :=      // ... custom code here ...

        // TODO – Better example of how to return _RegistrationTypeTracking / see i.e. MoibWmsAdhocRegistration..CreateRegisterItemImageRegColConf()

        _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.IsEmpty() then
            exit  // -- The Serial number is available
        else
            Error('Unknown serial no. "%1"', SerialNumber)// -- Not found

        _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"

...

Version History

VersionChanges
MOB5.1124Introduced