Wed, 05/26/2021 - 16:45 By Danny Rodrigue…
Dataverse Solution Checker

Dataverse Solution Checker

Presentation

If you're an experienced Dynamics warrior, you're used to go to Settings > Customization and extend your Microsoft Dataverse platform from there. But you may also know that there is another endpoint: make.powerapps.com. Via this interface, you can have access to the complete list of solutions in your Dataverse environment. In most cases, there are six columns displayed on this list.

Dataverse Solution Checker

In this article, we will focus on the last column: Solution check.

Definition

Introduce in early 2020, solution checker is a free feature enabling customizers and developers to perform a static analysis on solutions's components. The following components are concerned:

  • Plug-ins (C# code)
  • Custom Workflows activities (C# code)
  • Web resources (HTML and JS)
  • Dataverse configurations - e.g: SDK messages.

But it's not all! Solution checker also works with Canvas App! It will check the formulas, but also some performance linked configurations. The tool is quite similar to the Flow Checker.

At the end of the process, a report will be available to download. The report contains all issues identified as well as ways to resolve each issue.

Static analysis

The static analysis performed will check the solution against the best practice rules and identify problematic patterns. For those not familiar with it, static analysis can been seen as a code review by one of your talented but very lazy coworker: it will not run the code, it will not check if code's logic makes sense, but it will spot all dirty lines and code smells left there. 

Static analysis is a great tool to have in your DevOps pipeline. It's very useful, as it's usually used in the beginning of the development lifecycle, when you know the most about your code. But it's not a miracle solution! Static analysis has no understanding of the code and the developer intention, it can't understand the business need behind it. It's also based on a pre-defined set of rules, which can't be exhaustive.

On the bright side, static analysis tools are usually fast - at least faster than peer code review -, they will analyze the entire code and are very accurate - remember, it's a machine, not your lazy coworker.

How and when to use it

The Dataverse solution checker only works with solutions that can be exported from an environment - unmanaged solution. The column Managed externally? tells you the type of your solution.

Also, the tool is only available for cloud environments. So no on-premise for that one!

Another very interesting feature: automation! The solution checker can be triggered via some PowerShell lines, so it's perfect to integrate it into any DevOps pipeline - explained here and here.

Finally, you can find in Microsoft's documentation the list of best practices that the solution checker uses and also some commons issues and how to resolve them.

Example

Let's deep dive and see what the solution checker does!

First step, we create a new solution and add to it a web resource. The web resource is very simple and dummy: it takes the firstname of a contact and add Chronicles to it.

function contact_onload(){
    var firstname = Xrm.Page.getAttribute("firstname");
    firstname.setValue(firstname + " Chronicles");
    console.log("Firstname updated!")
}

Then, go back to the solution's list in make.powerapps.com, select Solution checker in the ribbon and Run.

Dataverse Solution Checker

This will launch the process. You can confirm that on the top right part of the screen:

Dataverse Solution Checker

You can see that the Solution checker is currently running. As detailed by Microsoft, there are seven different states for the tool.

states

When the process finishes, three thing happen:

  • The Solution check column changes and contains a text similar to Results as of 11:50 AM, 5/30/20.
  • A new notification appears in the Power Apps screen
  • An email is sent out to the user
Dataverse Solution Checker

The results can be accessed by selecting the solution and then either via the ribbon or via the three dots icon, as below:

Dataverse Solution Checker

In the browser, the report is displayed as a list, where results are grouped by solution's component.

Dataverse Solution Checker

Note that there are four possible values for the Severity column: High, Medium, Low, and Informational.

When selecting a specific result, a right panel will be displayed on the screen.

error_details

In this Details screen, all information about the static analysis is present: where is the issue, what is the issue about, how to fix it and a link to more documentation about the issue. Something nice is that the link doesn't always point to Microsoft's documentation, but to other official online resources.

The above example concerns a web resource. For example, if the selected check is regarding a plug-in, the Details panel is different. For example, it cannot contains the precise line number where the issue was found.

plugin2

Instead of viewing the results in the browser, we can also download them. In the downloaded ZIP file, there are a CSV and an XLSX files. The CSV file contains exactly the same information as in the browser. The Excel file also contains this information, but it has another Excel sheet with a nice donut chart and other Pivot Table functionalities.

Dataverse Solution Checker

Author's view

Personaly, I think it's a great easy-to-use tool. It highlights problems in your code and in a some cases event suggest best practices that I've never heard of. Obviously, if the solution checker doesn't report a problem, it doesn't mean that you code is top quality! Let's see the solution checker as the low-bar, as a quality that everything must reach at least.

In the same spirit, using the solution checker doesn't guarantee that the solution will be imported successfully in another environment. The check is performed against the solution components, that's all. It has no idea about the destination Dataverse environment.

Dataverse Solution Checker

Add new comment

Image CAPTCHA
Enter the characters shown in the image.