Versions Compared

Key

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

escription

Excerpt

You want to prompt the user to Confirm a message.

Example 1:

Receipt

Planned function posting

Using this event OnPostReceiveOrder_OnBeforePostAnyOrder


[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Receive", 'OnPostReceiveOrder_OnBeforePostAnyOrder''', true, true)]
    local procedure OnPostReceiveOrder_OnBeforePostAnyOrder(var _OrderValues: Record "MOB Common Element"; var _RecRef: RecordRef);
    var
        MobToolbox: Codeunit "MOB Toolbox";
    begin
        MobToolbox.ErrorIfNotConfirm('You are stopped for some condition... Do you want to continue?', _OrderValues);
    end;


Example 2: LockOrder (Planned function, when an Order is selected)

Using this event OnLockOrder_OnBeforeLockOrder

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Order Locking", 'OnLockOrder_OnBeforeLockOrder''', true, true)]
    local procedure ShowConfirmBox_OnBeforeLockOrder(_MobDocumentQueue: Record "MOB Document Queue"; var _RequestValues: Record "MOB NS Request Element"; var _IsHandled: Boolean)
    var
        MobToolbox: Codeunit "MOB Toolbox";
    begin
        if _RequestValues.GetValue('Type''Pick' then
            MobToolbox.ErrorIfNotConfirm(_RequestValues, 'You are stopped for some condition... Do you want to continue?');
    end;

 

Example

2

3: Custom Unplanned function 

Using this event OnPostAdhocRegistrationOnCustomRegistrationType


    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationType''', true, true)]
    local procedure OnPostAdhocRegistrationOnCustomRegistrationType(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _IsHandled: Boolean)
    var
    begin
        if _RegistrationType <> 'MyUnplanned' then
            exit;
        if _IsHandled then
            exit;

        If not (_RequestValues.GetValue('Force''True'then
            Error('ForceWarning:%1''You are stopped for some condition... Do you want to continue?');

        _IsHandled := true;
    end;

 

Example

3

4: Custom Unplanned function (legacy XML version)

Using this event OnPostAdhocRegistrationOnCustomRegistrationTypeAsXml


[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationTypeAsXml''', true, true)]
    local procedure OnPostAdhocRegistrationOnCustomRegistrationType(var _XMLRequestDoc: XmlDocumentvar _XMLResponseDoc: XmlDocument; _RegistrationType: Textvar _RegistrationTypeTracking: Text[200]; var _IsHandled: Boolean)
    var
        MobToolbox: Codeunit "MOB Toolbox";
    begin
        if _RegistrationType <> 'MyUnplanned' then
            exit;

        if _IsHandled then
            exit;

        MobToolbox.ErrorIfNotConfirm('You are stopped for some condition... Do you want to continue?', _XMLRequestDoc);

        MOBToolbox.CreateSimpleResponse(_XMLResponseDoc, '');
        _IsHandled := true;
    end;

Example 4: LockOrder (Planned function, when an Order is selected)

Using this event OnLockOrder_OnBeforeLockOrder

[EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Order Locking", 'OnLockOrder_OnBeforeLockOrder''', true, true)]
    local procedure ShowConfirmBox_OnBeforeLockOrder(_MobDocumentQueue: Record "MOB Document Queue"; var _RequestValues: Record "MOB NS Request Element"; var _IsHandled: Boolean)
    var
        MobToolbox: Codeunit "MOB Toolbox";    begin
        if _RequestValues.GetValue('Type''Pick' then
            MobToolbox.


ErrorIfNotConfirm(_RequestValues, 'You are stopped for some condition... Do you want to continue?');
    end;



How it works behind the scenes 

The key ”ForceWarning:” is prefixed to a regular ERROR() command.

Code Block
languagexml
Error('ForceWarning:%1', MyConfirmMessage);


  1. This way front-end App knows to a display a Confirm dialog

    1. Choosing "Cancel" will return the user to the previous screen
    2. Choosing "Confirm" will automatically repeat the request with a “Force” tag included

  2. The Force tag tells the backend that the Process can now be completed and NOT halted by the ERROR command.



Version History

VersionChanges
MOB5.12Introduced