Another tool I am pleased to announce - Mockaroo Data Munger!
This tool is an interface between Mockaroo and your CDS environment. Mockaroo is an excellent random data generator which has been my go to source for data over the last couple of years for building demo or test data sets. I found myself regularly configuring Mockaroo data exports, creating Excel spreadsheets and then importing them to the latest demo environment.
As Mockaroo has an API, the next logical step is to bring this API to the XrmToolBox. This is so I can cut out the middle man - no need to do the export to Excel, map the data in a CDS import and wait for the import, let a tool do it for me.
(Blame Chris Huntingford for the name)
I created a tool to allow creation of random data using the Mockaroo API available in XrmToolBox here.
Walkthrough of the Tool
First of all, you will need a Mockaroo Key. Go here and sign up. A Mockaroo account is free, if you can cope with 200 requests a day, 1000 rows per request. Pretty impressive for free. In all my testing, I have never scratched these limits. As Mockaroo paid plans are intended to be used by testers, calling the api for a single record multiple times etc, for our usage, the free plan is more than enough.
Once you have an account, go to My Account and grab your API Key.
In the Tool, enter this in the toolbar.
You can save this key along with your map by hitting the Save Current Map button.
Next, select an entity. The fields that are displayed are those that are available for entry when a record is created. Certain fields aren’t, like the Create and modified Dates and users. Others are calculated/roll up fields.
Choose your Mock Types
Mockaroo provides various types of data, from address information to car makes, MAC addresses and other useful information. Useful to someone, maybe not you. These are listed here. I have transitioned those to selectable types in the grid.
Choose a row and hit the checkbox. This will populate the mock types that are relevant to your selection - even I try to prevent text going into numbers. If there is any options for you to choose from or configuration of the type, the Options field is populated with the defaults. You can change these defaults by clicking on the little grey box (not to self, add an icon).
A small form will pop up, allowing you to make modifications to the default selections. This could be selecting one or more choices for a picklist, setting the minimum or maximum for numbers or the number of paragraphs of random text you need for your memo.
Once you are happy with your data configuration, it is time to call the API. Select the number of records you desire and hit Get Mockaroo Data.
After hitting the button, the Results tab becomes available. This lists the data that has been generated for you, before you insert it in your environment.
The raw values are displayed, as in the numeric value for any picklists and guids for any lookups. On the road map to show the friendly versions of these records.
If you are happy, hit Create Data. This will insert the data and present any issues that are returned in doing so.
Creating data has a lot of issues, most are down to the data. You can not assign records to users without the appropriate security rights for example. There are a multitude of rules that CDS has, particularly when using the first party apps like Sales or Field Service. These are not usually for data integrity reasons, but business logic, fired prior to the record being created.
Unfortunately, all I can do is present the issues to you so you can fix the data.
I want to add Resolving cases and other business logic that is done after the record is created normally to allow simple creation of these records. I am also looking for suggestions how it can be improved, particularly around the types of data you need to generate - combining fields for example.
Go over to the GitHub page to raise an issue https://github.com/LinkeD365/MockarooDataMunger/ and let me know what you think.