Versions Compared

Key

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


Info
titleRequirement

Android App version 1.5.79

Use this event to

Excerpt

Interrupt posting and add extra steps based on values already collected.

  • Add extra steps during posting of unplanned document types (interrupt posting to collect addtional steps)
  • Used for "conditional" steps i.e. when values from previously collected steps determines if the step are to be included
  • Posting are restarted (started over) when the additional steps have been collected on the mobile device
  • Events are executed every time posting starts over and can be used to chain even more steps.

Description

Collecting additonal values from new steps (created using this event) must go hand-in-hand with additonal customizations to handle such values:

...

    // [Template]
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps''', true, true)]
    local procedure OnPostAdhocRegistration_OnAddSteps(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
    begin
    end;

Example

Workflow for customization example below:

...

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps''', true, true)]
    local procedure MyOnPostAdhocRegistration_OnAddSteps(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
    var
        Location: Record Location;
        ItemTrackingMgt: Codeunit "Item Tracking Management";
        MobWmsAdhocReg: Codeunit "MOB WMS Adhoc Registr.";
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
        ItemNumber: Code[20];
        VariantCode: Code[20];
        LocationCode: Code[10];
        LotNo: Code[50];
        SerialNo: Code[50];
        RegisterSerialNumber: Boolean;
        RegisterLotNumber: Boolean;
        RegisterExpirationDate: Boolean;
        ExistingExpirationDate: Date;
        EntriesExist: Boolean;
    begin
        if _RegistrationType <> MobWmsToolbox."CONST::UnplannedCount"() then
            exit;

        if _RequestValues.HasValue('ExpirationDate'then
            exit;   // already collected, break to avoid adding the same new step indefinitely

        ItemNumber := _RequestValues.GetValue('Item', true);        // mandatory
        VariantCode := _RequestValues.GetValue('Variant', false);   // optional, only exists if item has associated variants
        LocationCode := _RequestValues.GetValue('Location', true);  // mandatory
        LotNo := _RequestValues.GetValue('LotNumber', false);       // optional, only used if RegisterExpirationDate is true
        SerialNo := _RequestValues.GetValue('SerialNumber', false)// optional, only used if RegisterExpirationDate is true

        MobWmsAdhocReg.DetermineNegAdjustItemTracking(ItemNumber, RegisterSerialNumber, RegisterLotNumber, RegisterExpirationDate);
        if not RegisterExpirationDate then
            exit;   // ItemTrackingCode."Man. Expir. Date Entry Reqd." = false

        // ExpirationDate is needed: Verify if an existing ExpirationDate can be derived from existing entries
        // The 'GetWhseExpirationDate' function used below will return if any entries exists for the lot number EVEN if such entries all has a blank expiration date or is closed
        Location.Get(LocationCode);
        EntriesExist := ItemTrackingMgt.GetWhseExpirationDate(
            ItemNumber,
            VariantCode,
            Location,
            LotNo,
            SerialNo,
            ExistingExpirationDate);

        if (ExistingExpirationDate <> 0D) or EntriesExist then
            exit;   // same break condition as 'GetWhseExpirationDate' used in standard posting code

        // Add the new 'ExpirationDate'-step
        _Steps.Create_DateStep_ExpirationDate(50000, ItemNumber);

        //
        // Additional changes:
        // 
        // Currently no events in codeunit "MOB WMS Adhoc Registr.".PostUnplannedCountRegistration() supports suppressing the error message concerning a missing expiration date
        // on entries when the journal line is created. In this case we will need to clone the code from 'PostUnplannedCountRegistration()' to a new adhoc RegistrationType and do
        // our changes to 'PostUnplannedCountRegistration()' in a copy of the code.
        //
        // However, cloning code should be avoided whenever possible. You are always welcome to raise a support ticket to have new events included in standard Mobile WMS to help
        // your customization needs.
        //
        // In most cases you should be able to use events:
        // * OnPostAdhocRegistrationOnXXX_OnAfterCreateWhseJnlLine(_RequestValues, TempWhseJnlLine)   or
        // * OnPostAdhocRegistrationOnXXX_OnAfterCreateItemJnlLine(_RequestValues, TempItemJnlLine)
        //
    end;



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

...