Dynamics 365 Business Central: Query objects, AppSourceCop and breaking changes.

When developing Dynamics 365 Business Central extensions for AppSource, it’s mandatory to activate the AppSourceCop code analyzers in order to detect if your codebase is compliant with the AppSource rules. AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource.

One of the feature of the AppSourceCop analyzer is that it can also detect if you have breaking changes between different versions of an extension and I think that everyone of you know that one of the most common breaking change in an extension occurs when you remove things. If you have version 1.0.0.0 of an extension where in a table object you have a field Field1 and in version 1.0.0.1 you remove Field1, this is a breaking change and AppSourceCop blocks the code validation. The same occurs in tableextensions, page, pageextensions etc.

But what about query objects?

Dynamics 365 Business Central query objects enable you to retrieve records from one or more tables and then combine the data into rows and columns in a single dataset. Query objects can also perform calculations on data, such finding the sum or average of all values in a column of the dataset.

Now let’s imagine to create an AppSource extension (version 1.0.0.0) where I define a simple query object in AL like the following:

The query gives me some data about customer’s sales and their salespersons. I enable the AppSourceCop analyzer for validation. All is good (validation passed) and I publish on AppSource version 1.0.0.0 of my wonderful app.

Time flies and after some days I want to remove the City field. In version 1.0.0.1 of my extension I do something like the following:

The City field is physically removed from the query object now.

I run AppSourceCop validation of version 1.0.0.1 of this app with comparison to the previous version (1.0.0.0) and validation is passed… no errors are thrown by AppSourceCop:

I can then publish my app on the marketplace with a breaking change!

Why this?

Because at the moment the AppSourceCop code analyzer will not detect breaking changes on query objects. But removing a field on a query object is absolutely a breaking change, so be aware of that.

I’ve submitted an idea to fix this here for reference (just in case you want to support).

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.