Provide Title and custom actions to Error dialogs

Important

This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365, Power Platform, and Cloud for Industry release plans.

Enabled for Public preview General availability
Users, automatically Mar 1, 2023 Apr 1, 2023

Business value

To help users get unblocked from issues when working with Business Central, we've introduced the capability to allow developers to unblock users when they encounter issues right away by choosing a corrective action. Making error messages more user-friendly helps build trust in Business Central while at the same time saving time in correcting common issues.

Feature details

Developers can now set the Title property on Error dialogs that are presented to the user to enrich issue description. On top of that, using the ErrorInfo object, developers can add up to three custom actions that will be displayed on the Error dialog to provide users with corrective actions. This can be achieved by calling the AddAction method on the ErrorInfo object, which can be passed to AL methods that support ErrorInfo such as Error, TestField, FieldError, and others.

The AddAction method accepts three parameters:

  • Caption: The text string that appears as the caption of the action in the error UI.
  • CodeunitID: The ID of the Codeunit to run when the action is initiated from the error UI. 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.
  • Method Name: The name of the method in the Codeunit, which is specified by the CodeunitID parameter, that you want to run for the action.

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.

See also

ErrorInfo.AddAction(Text, Integer, Text) Method (docs)