Blog Archives

Dynamics attributes utilisation by FetchXML

XrmToolbox is an amazing free utility formed by many tools that have been developed by the community. During the last weeks, I have been particularly using and enhancing the Attribute Usage Inspector. This tool tells you the fields utilisation in your Dynamics 365 Customer Engagement (CRM) environment.

Figure 1 – Opportunity attributes utilisation for all records

In this article, I’ll show how I have extended this utility to allow FetchXML queries which defines the scope of the attributes to be analysed.

Visualising what attributes are used and what aren’t can be extremely helpful in your project analysis to understand adoption and drive new features.

In the above Figure – 1, you can see the attributes utilisation for the opportunity entity. In this case, the tool is using all the records and attributes in the system. You could also filter these attributes or even use a SQL query:

Figure 2 – Attribute Usage Inspector Settings. New FetchXML query option.

Additionally, I have recently added a new option to allow a FetchXML query (see “Use FetchXML query” in above Figure 2), which will define what attributes and records will be analysed  based on the results of the same query. 

Once you have selected the new setting “Use FetchXML query“, you will find a new dialog after you click on an entity:

Figure 3 – FetchXML Query dialog

The new FetchXML Query dialog allows basically 3 things:

  1. Generate the FetchXML query using a System View.
  2. Generate the FetchXML query using a User View.
  3. Use your own FetXML query just editing or pasting the text in the editor.

The FetchXML Query dialog also validates the query in run time to avoid potential mistakes. 

For instance, let’s say we want to understand certain opportunity attributes utilisation for those records created in the last months. Using the XrmToolbox FetchXmlBuilder, I have generated my own FetchXML:


Figure 4 – FetchXML Builder tool to generate custom FetchXML

I will then paste the same query in the FetchXML Query dialog shown in Figure 3:

Figure 5 – Attribute Usage Inspector using a custom FetchXML query

After clicking OK, the tool will use the same custom query to provide the corresponding results:


Figure 6 – Attribute Usage Inspector results with a custom FetchXML query

Notice how only a subset of the attributes are presented in the results and the number of records and % utilisation are determined by the FetchXML query.

How do I get this tool?

After you have downloaded the main XrmToolbox utility from https://www.xrmtoolbox.com, go to its Plugins Store and search for “Attribute Usage”, then install the Attribute Usage Inspector plugin:


Figure 7 – Install Attribute Usage Inspector from XrmToolBox Plugins Store

In case you were already using it, notice there is a new version 1.2018.9.11, which contains the new FetchXML query feature.

Where is the code?

The whole tool is open source and you can find the code here:

https://github.com/MscrmTools/MscrmTools.AttributeUsageInspector

https://github.com/rtebar/MscrmTools.AttributeUsageInspector