Confirm() must be implemented through the Confirm Management codeunit (AC0004)
Direct calls to Confirm() bypass the safeguards and features provided by the Confirm Management codeunit in the System Application. Using Confirm Management ensures automatic validation of IsGuiAllowed(), prevents runtime failures in non-GUI contexts, and allows explicit control over the default response (true or false).
The Confirm Management codeunit centralizes confirmation dialog handling and provides a consistent, testable pattern across the application.
A code fix is available for this diagnostic.
Example
The following code uses the built-in Confirm method directly:
codeunit 50100 MyCodeunit
{
procedure MyProcedure()
begin
if Confirm('Are you sure?') then; // Confirm() must be implemented through the "Confirm Management" codeunit from the System Application. [AC0004]
end;
}
To fix this, use the Confirm Management codeunit:
codeunit 50100 MyCodeunit
{
procedure MyProcedure()
var
ConfirmManagement: Codeunit "Confirm Management";
begin
if ConfirmManagement.GetResponse('Are you sure?', false) then;
end;
}
See also
- AC0005 - GlobalLanguage() must be implemented through the Translation Helper codeunit