Dialog.Error(Text [, Any,...]) Method
Version: Available or changed with runtime version 1.0.
Displays an error message and ends the execution of AL code.
Syntax
Dialog.Error(Message: Text [, Value: Any,...])
Note
This method can be invoked without specifying the data type name.
Parameters
Message
Type: Text
This string contains the text of the error message you want to display to the user. Use percent signs (%) or number signs (#) to insert variable values into the string. Place the percent or number signs where you want to substitute the variable value. The string can be a label that is enabled for multilanguage functionality.
[Optional] Value
Type: Any
Any variable or expression to be inserted in String. You can insert up to 10 values. For '#'-type fields, the value is truncated according to the total number of number-sign characters in String. For '%'-type fields, the full length of the value is printed.
Remarks
The window is automatically sized to hold the longest line of text and total number of lines. By calling the method with an empty string the execution of AL code ends without displaying a message.
Programming Guidelines
We recommend the following guidelines for error messages:
Describe what is wrong and how to solve the problem.
Write a short descriptive message. Do not use more words than necessary.
Always end the error message with a period.
Use a text constant for the text of the message.
For more information, see Progress Windows, Message, Error, and Confirm Methods.
Example
This example shows how to use the Error
method.
var
AccountNo: Integer;
Text000: Label 'Finance Account #1#### must not be blocked.';
Text001: Label 'Placeholder message.';
begin
AccountNo := 1230;
// The execution stops when the error statement is executed
// and all following statements will never be executed.
Error(Text000, AccountNo);
Message(Text001); // This line is not executed.
end;
The error window displays the following:
Finance Account 1230 must not be blocked.
The Error
method causes execution of AL code to stop. Message Method is never executed.
See Also
Dialog Data Type
Get Started with AL
Developing Extensions
Analyzing Error Method Telemetry
Feedback
Submit and view feedback for