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.


Update [OrderGroup]
Set CustomerName = 'John Smith'
CustomerName <> 'John Smith'
Update [OrderGroupAddress]
Set FirstName = 'John', LastName = 'Smith', Line1 = 'Address Line 1', City = 'City', PostalCode = 'Postcode', [Name] = 'John Smith'
[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'
SalesName <> 'John Smith'
Update cls_Contact
Set FullName = 'John Smith', FirstName = 'John', LastName = 'Smith' , BirthDate = '1990-01-01', Email = 'john.smith@test.com'
FullName <> 'John Smith'
Update cls_Address
Set [Name] = 'John Smith', FirstName = 'John', LastName = 'Smith' , Line1 = 'Address Line 1', City = 'City', PostalCode = 'Postcode'
[Name] <> 'John Smith'

About the author

Naveed Ul-Haq

I am a UK-based Technical Architect, Founder & Technology Evangelist. I'm Optimizely MVP & Optimizely SME on Content Cloud and Commerce Cloud. I love working on .NET-based CMS, eCommerce solutions, .NET Core, DevOps, and Cloud computing. I'm also a Certified Optimizely Content Cloud Developer, Certified Optimizely Commerce Cloud developer, Optimizely B2B Commerce developer and Microsoft Certified Professional in Azure application development. I spend my free time with my family and reading books. You can contact me at hello@naveedulhaq.com

View all posts

Leave a Reply

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