Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Description
Excerpt |
---|
You want to prompt the user to Confirm a message. |
Example 1: LockOrder (Planned function, when an Order is selected)
Using this event OnLockOrder_OnBeforeLockOrderDescription
Excerpt |
---|
You want to prompt the user to Confirm a message. |
Example 1: Planned function posting
Using this event OnPostReceiveOrder_OnBeforePostAnyOrder
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Order LockingMOB WMS Receive", 'OnLockOrderOnPostReceiveOrder_OnBeforeLockOrderOnBeforePostAnyOrder', '', true, true)]
local procedure ShowConfirmBox OnPostReceiveOrder_OnBeforeLockOrder(_MobDocumentQueue: Record "MOB Document Queue"; OnBeforePostAnyOrder(var _RequestValuesOrderValues: Record "MOB NS Request ElementMOB Common Element"; var _IsHandledRecRef: BooleanRecordRef);
var
MobToolbox: Codeunit "MOB Toolbox";
begin
if _RequestValues.GetValue('Type') = 'Pick' then
MobToolbox MobToolbox.ErrorIfNotConfirm(_RequestValues, 'You are stopped for some condition... Do you want to continue?'?', _OrderValues);
end;
Example 2:
Unplanned MoveLockOrder (Planned function, when an Order is selected)
Using this event OnPostAdhocRegistrationOnUnplannedMoveOnLockOrder_OnAfterCreateWhseJnlLine
Find other functions here PostAdhocRegistration - Integration Events by Registration Type
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.MOB WMS Order Locking", 'OnPostAdhocRegistrationOnUnplannedMoveOnLockOrder_OnAfterCreateWhseJnlLineOnBeforeLockOrder', '', true true, true true)]
local localprocedure OnPostAdhocRegistrationOnUnplannedMove ShowConfirmBox_OnAfterCreateWhseJnlLineOnBeforeLockOrder(var_RequestValuesMobDocumentQueue: Record "MOB NS Request ElementMOB Document Queue"; var _WhseJnlLineRequestValues: Record "Warehouse Journal Line")
var
MobToolbox: Codeunit "MOB Toolbox";
begin
MobToolboxMOB 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 'You are stopped for some condition... Do you want to continue Do you want to continue?');
end;
Example 3:
CustomUnplanned
functionMove
Using this event OnPostAdhocRegistrationOnCustomRegistrationType OnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateWhseJnlLine
Find other functions here PostAdhocRegistration - Integration Events by Registration Type
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationTypeOnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateWhseJnlLine', '', true, true)]
localprocedure My01OnPostAdhocRegistrationOnCustomRegistrationType(_RegistrationType: Text; OnPostAdhocRegistrationOnUnplannedMove_OnAfterCreateWhseJnlLine(var _RequestValues: Record "MOB NS Request Element"; var _SuccessMessage: Text; var _RegistrationTypeTracking: Text; var _IsHandled: Boolean)
var
MobToolbox: Codeunit "MOB Toolbox";
begin
if _RegistrationType <> 'MyNewUnplannedName'then
exit;
if _IsHandled then
exit;
WhseJnlLine: Record "Warehouse Journal Line")
var
MobToolbox: Codeunit "MOB Toolbox";
begin
MobToolbox.ErrorIfNotConfirm(_RequestValues, 'You are stopped for some condition... Do you want to continue?');
_SuccessMessage := 'My custom success message';
_RegistrationTypeTracking := 'My custom description for the document queue (column RegistationType)'?');
_IsHandled := trueend; end;
Example
54: Custom Unplanned function
(legacy XML version)Using this event OnPostAdhocRegistrationOnCustomRegistrationTypeAsXml OnPostAdhocRegistrationOnCustomRegistrationType
[EventSubscriber(ObjectType::Codeunit, CodeunitCodeunit::"MOB WMS Adhoc RegistrMOB WMS Adhoc Registr.", 'OnPostAdhocRegistrationOnCustomRegistrationTypeAsXmlOnPostAdhocRegistrationOnCustomRegistrationType', '', truetrue, truetrue)]
local procedure My02OnPostAdhocRegistrationOnCustomRegistrationTypeAsXml localprocedure My01OnPostAdhocRegistrationOnCustomRegistrationType(var _XMLRequestDocRegistrationType: XmlDocumentText; var var _XMLResponseDoc: XmlDocument; _RegistrationType: Text; var _RegistrationTypeTracking: Text[200]; var _IsHandled: Boolean)
var
MobToolbox: Codeunit "MOB Toolbox";
begin
if _RegistrationType <> 'MyUnplanned' then
exitRequestValues: Record "MOB NS Request Element"; var _SuccessMessage: Text; var _RegistrationTypeTracking: Text; var _IsHandled: Boolean)
var
MobToolbox: Codeunit "MOB Toolbox";
begin
if _RegistrationType <> 'MyNewUnplannedName'then
exit;
if if _IsHandled then
exit;
MobToolboxIsHandled then
exit;
MobToolbox.ErrorIfNotConfirm('You are stopped for some condition... Do you want to continue?', _XMLRequestDoc);
MOBToolbox.CreateSimpleResponse(_XMLResponseDoc, '');
_IsHandled := true;
end;_RequestValues, 'You are stopped for some condition... Do you want to continue?');
_SuccessMessage := 'My custom success message';
_RegistrationTypeTracking := 'My custom description for the document queue (column RegistationType)';
_IsHandled := true;
end;
Using HTML formatting:
(Minimum Mobile App version 1.5.9)
You can use simple html formatting of the text to display in the confirmation dialog.
HtmlTxtToDispaly :=
'<html>' +
'<b><font color="blue">' + 'My Text 1 in Bold and Blue' +
'</font></b>' + '<br><i>' + 'My Text 2 on new line in Italic' +
'</i><p>' + 'My Text 3 after paragraph' + '<p><b><font color="red">' +
'My Text 4 in Bold and Red' + '</font></b>' +
'<br><i>' + 'My Text 5 on new line in Italic' +
'</i><p>' + 'My Text 6 after paragraph' +
'</html>';
Note
Confirm dialogs will cause an Error entry in the Windows Application Event Log.
If this is an issue for you, consider if your code can be restructured to display the information at existing elements, rather than requiring a confirmation.
How it works behind the scenes
The key ”ForceWarning:” is prefixed to a regular ERROR() command.
Code Block | ||
---|---|---|
| ||
Error('ForceWarning:%1', MyConfirmMessage); |
- This way front-end App knows to a display a Confirm dialog
- Choosing "Cancel" will return the user to the previous screen
- Choosing "Confirm" will automatically repeat the request with a “Force” tag included
- The Force tag tells the backend that the Process can now be completed and NOT halted by the ERROR command.
Filter by label (Content by label) showLabels false max 150 showSpace false title See also excludeCurrent true cql label = "dialog"
Example using HTML formatting: