Handling actions on errors
To improve the user experience on error messages, you can also add custom actions on an error message.To do that, you can use the ErrorInfo object and thenuse the AddAction method:
ErrorInfo.AddAction(Caption: Text, CodeunitID: Integer, MethodName: Text)
where CodeunitID is the ID of the codeunit to execute when the action is initiated from the error user interface. The codeunit should contain at least one global method to be called by the error action. The global method must have an ErrorInfo data type parameter for accepting the ErrorInfo object.MethodName is the name of the method to execute in the previously defined codeunit.As an example, consider the following codeunit:
codeunit 50000 "PACKT Error Handler"
{
procedure Handler1(ReceivedErr: ErrorInfo)
begin
//...
end;
procedure Handler2(ReceivedErr: ErrorInfo)
begin
//...
end;
}
You can create a custom error message that displays to the users two actions...