Community Q&A

MB-820 — frequently asked questions

Community-vetted answers to 9 common questions about this exam, each traced back to a specific practice question.

Questions from real practice questions

Each Q&A comes from a specific question — follow the link for the full analysis

Applying No. Series Design Pattern in Business Central OnInsert Trigger

Why is ContosoSetup.Get() placed after the empty check?

It is placed there to optimize performance by only fetching the setup record when a new number is actually needed, avoiding unnecessary DB hits.

What happens if I omit TestField('Vendor Nos.')?

Omitting it risks runtime errors if the setup record exists but the specific No. Series field is blank, as InitSeries would fail or behave unpredictably.

AL Telemetry LogMessage Verbosity and Scope

What are the valid TelemetryScope values in Business Central AL?

The valid values are TenantAdmin, ExtensionPublisher, and All. CustomerContent is not a valid option.

When should I use Verbosity::Critical vs Information?

Use Critical for errors or failures that require immediate attention. Use Information for general operational logs that do not indicate problems.

Saving Query Data to a File with SaveAsXml in AL

Which SaveAs methods does the AL Query data type support?

The Query type supports SaveAsXml, which writes the query result to an XML document in a file. It has no SaveAsHtml, SaveAsExcel, SaveAsWord, or SaveAsPdf methods; those belong to the Report type.

How do I export query results to Excel or JSON in Business Central?

A query cannot render Excel or JSON directly. Export to XML with SaveAsXml and transform it, or read the query buffer into records and build a JsonObject/JsonArray manually, or expose the data through an API page or an Excel-friendly report layout.

Do I need to open the query before calling SaveAsXml?

Yes. Execute the query with Items Query.Open() so it fetches data from the database, then call SaveAsXml to write the result set to a file, and finally call Close to release resources.

Defining Custom Views in an AL Page Extension

Why can't I use SharedLayout = true for this Customer List view?

SharedLayout = true makes the view reuse the page's existing field layout, so you cannot remove fields. Since the requirement is to show only some custom fields, the view needs its own layout via SharedLayout = false.

Where is the where filter placed for a view in a page extension?

Inside the view block in the views section, for example where("Balance (LCY)" > 1000, "Country/Region Code" = 'US'), alongside the optional layout block when SharedLayout is false.