DEV Community

Cover image for Resetting Data in Lower Environments Without Wiping Everything in Dynamics 365 CE
Nikhil Sarpatwari
Nikhil Sarpatwari

Posted on

Resetting Data in Lower Environments Without Wiping Everything in Dynamics 365 CE

Working with lower environments in Dynamics 365 CE often feels like walking a tightrope:

You need realistic data, but not a full production dump. You want to test processes, but avoid triggering live journeys or communications.

So how do you reset or refresh data in a sandbox or dev environment without wiping everything?

Here’s what has worked well in real-world projects:


1. Use Configuration Migration Tool (CMT) with Filters

Instead of copying everything, use the CMT (from the Power Platform Tools) to export:

  • Reference data like status reasons, SLA rules, etc.
  • A subset of sample Cases, Opportunities, etc. using custom FetchXML

Pro Tip:

Include related child records (like activities or lookups) using the dependency mapping option during export.


2. Keep Test Data Scripts in Source Control

For dummy transactional records, create a test data seeding project:

  • Use XrmToolBox Data Transporter or PowerShell scripts to insert predefined records
  • Store JSON or CSV versions of data with GUIDs
  • Keep IDs consistent to avoid breaking lookups across tables

Useful for creating:

  • Sample Accounts with Activities
  • Dummy Contacts with consent flags
  • Clean cases with varied statuses

3. Use Azure DevOps Pipeline Variables to Toggle Data Seeding

If you're deploying via pipelines, add an optional "Data Reset" toggle:

  • When enabled, run seeding logic
  • When off, skip it for CI-only deployments

This gives you environment-sensitive resets without affecting live data or build speed.


4. Clean Up Old or Sensitive Data (Soft Reset)

Use Power Automate or Plugins to:

  • Nullify email addresses, phone numbers
  • Remove attachments from Notes
  • Anonymize sensitive fields (names, addresses)

Perfect when:

  • You’re cloning from Prod but want compliance
  • You want to preserve record structures but mask data

5. Use Backup/Restore Smartly (But Carefully)

Dataverse backups let you restore full environments. But you don’t need to wipe everything:

  • Clone environment from Prod into UAT/SIT
  • Immediately clean sensitive fields post-clone (via flow/plugin)
  • Remove any customer insights journeys or marketing segments to prevent emails

Key Tips

Strategy Use When... Tools
CMT + FetchXML You want partial export/import Configuration Migration Tool
Scripted Inserts You need consistent test data PowerShell, XrmToolBox
Data Masking You cloned from Prod Power Automate, Plugins
Pipeline Seeding You want CI/CD-controlled resets Azure DevOps

Final Thoughts

Not every environment needs a full prod copy. In fact, too much data often slows testing and breaks flows. Smartly scoped data resets give your team just enough to build, demo, and test — without surprises.

Top comments (0)