Many organizations require that personal data in non-production Dataverse environments is anonymized. This may be company policy or a legal requirement such as GDPR which governs the collection and processing of personal information in the European Union. Here is a quick tip on how to use the Bulk Data Updater for XrmToolBox to anonymize Dataverse data. In case you are not familiar with the Bulk Data Updater, it was developed by the wonderful Jonas Rapp and it allows you to query and update Dataverse records in bulk. Full instructions on how to use it are available on Jonas’s site
While there is no random character generator functionality in the Bulk Data Updated it does contain a generic string substitution functionality in the form of XRM Tokens. These can be utilized to anonymize Dataverse data. There are different types of tokens and they are all detailed here
To use an XRM Token simply select the field you want to anonymize, in Bulk Updater, and change the type of update to calculated. Enter the XRM Token you want to use in the text box. In this example, I am replacing the last name with the first letter of the last name followed by the guid of the contact id. If you are happy with the expected result then select Add Attribute to include it in the fields to be updated
There are lots of options you can use with XRM Tokens including sequences and I have used use this option for email addresses e.g. {lastname|}[#|1001|0000000]@example.com. You can also use conditional substitutions for example you can check if a field is not null and update if it is not.
<iif|{emailaddress1}|neq||{emailaddress1|<Left|1>}2{contactid|<Left|10>}@example.com|no email|>
Once you have configured which fields you are anonymizing then select the update records option. You may want to increase the batch size for better performance.
Once your update has run your contact data will be anonymized. Don’t forget to clear down your audit table.
I hope you found this quick tip on how to anonymize Dataverse useful. If you use XrmToolBox or Bulk Updater please consider making a well deserved contribution to the authors.