On approximately December 9th 2019 Microsoft stealth-released a new feature in version 220.127.116.11 of the Dynamics 365 configuration migration tool to filter exported records. This has undoubtedly been one of the most desired features for this tool by those who have used it to prepare complex data sets.
I suspect this tool has historically been named the “configuration” migration tool to emphasize the limited intended use of this tool to be used for “configuration” data and not complex data migration purposes. Those who ignored this limitation would live with the fact that all records for the selected entities would be exported, and then post-process the exported data to remove unwanted records.
Now that the filtering feature is here, it should streamline data export efforts. I’ve done some some early exploring to see how it works and what it can do and here is what I found.
To find the feature, click on Configure Import Settings in the Tools menu.
Then, click the new “Edit FetchXML” button.
A simple window opens where the FetchXML text is to be entered.
To generate the FetchXML, I’ve used the advanced find window in a Dynamics 365 instance and entered a simple query with a filter to retrieve accounts that start with the letter A, then clicked the Download FetchXML button.
Pasting the text from the downloaded file into the window and clicking OK produces an unexpected error message:
It looks like some validation is being performed and a couple aspects of the query are not considered valid. Apparently the output-format attribute isn’t allowed on the fetch element, and the attribute element isn’t allowed under the entity element. This shouldn’t cause any problems because neither one controls filtering of exported records. Let’s try again with those removed:
Another error – the order element isn’t allowed under the entity element either. I was thinking it would be interesting to see whether ordering would be respected but apparently that isn’t possible. Time to try one more time without the order element:
Success, the window closes and now the checkbox beside the Edit FetchXML button is selected.
Now let’s see the results after saving the schema schema file and exporting the data.
Inside the schema file we can see the filter is present in a new filter element:
Interestingly the Fetch XML has been encoded – arguably it didn’t need to be encoded since it’s already XML, and being encoded will make hand editing the file a little more difficult, but this isn’t critical.
Lastly the data file after unzipping it shows that the records were indeed filtered.
All in all a fairly straightforward process. A little bit of fine-tuning in the validation experience could make this a little more streamlined but it does the job of filtering the exported records! It will be interesting to try out some more complex queries to see if any other surprises come up.