A handy script to anonymize Epicommerce data

While working with Episerver commerce a lot of times we come across a challenge to copy production website data down to integration and pre-production environment. Since integration is normally a Dev environment and pre-production a test environment we do not want customer’s information to be copied in these environments.

So I created a handy script to anonymize customer and order data. Few assumptions;

  • This script purposely does not remove data because we might need to investigate a production issue with access to database records.
  • This script does not override the customer’s usernames.
  • you are using default identity provider.

Script

Update [OrderGroup]
Set CustomerName = 'John Smith'
where
CustomerName <> 'John Smith'

Update [OrderGroupAddress]
Set FirstName = 'John', LastName = 'Smith', Line1 = 'Address Line 1', City = 'City', PostalCode = 'Postcode', [Name] = 'John Smith'
where
[Name] <> 'John Smith'

Update [Orders]
Set ZipCode = 'Postcode', SalesName = 'John Smith', Street = 'Street name', City = 'City', DeliveryName = 'John Smith', Address_Street = 'Street name', Address_City = 'City'
where
SalesName <> 'John Smith'

Update cls_Contact
Set FullName = 'John Smith', FirstName = 'John', LastName = 'Smith' , BirthDate = '1990-01-01', Email = '[email protected]'
where
FullName <> 'John Smith'

Update cls_Address
Set [Name] = 'John Smith', FirstName = 'John', LastName = 'Smith' , Line1 = 'Address Line 1', City = 'City', PostalCode = 'Postcode'
where
[Name] <> 'John Smith'

About the author

Naveed Ul-Haq

I am a UK based technical architect. I love working with .NET based CMS, eCommerce solutions, .NET Core, DevOps, and Cloud computing. I am a Certified Episerver CMS developer, MCSD (Microsoft Certified Solution Developer) and MCP in Azure application development. I spend my free time with my family and reading books. You can contact me on [email protected]

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *