D365Forge

Catalogue › Integration and Data › data-mapping-and-cleansing

Data mapping and cleansing

Department
Integration and Data
Stages
Initiate, Implement
Modules
All
Status
reviewed
Copilot Cowork
Integration and Data plugin for Copilot Cowork, or this skill on its own: Download SKILL.md
Claude Code
/plugin install integration-and-data@d365forge
Licence
CC BY 4.0, by Simon Foote, Robert Peledie

The mapping is where migration effort really sits. Each row of it is a small decision about meaning, and every one deferred becomes a defect in a mock migration. Projects go wrong by mapping against a data model that is still changing, by treating cleansing as something the business will do later, and by loading duplicates on the assumption that duplicate detection will catch them afterwards.

Clean data also matters well beyond go-live. Copilot summaries, routing, segmentation and reporting all inherit whatever quality the migration delivers, so shortcuts here show up for years.

When to use

Not this skill: integration-and-data:migration-strategy for scope, tooling and load order, solution-architecture:cross-module-data-model for designing the target model, integration-and-data:reconciliation for proving what was loaded.

Questions to ask first

  1. Is the target data model stable enough to map against? Mapping against a moving model creates rework every sprint.
  2. What identifiers exist in each source, and are they unique and stable? They become alternate keys and the basis for re-runnable loads.
  3. Who in the business can decide which duplicate survives and what a legacy code means? Without a named decision-maker, cleansing stalls.
  4. Which quality problems can be fixed in the source before extract? Fixing at source is cheaper and keeps systems consistent during any coexistence period.
  5. What does good enough look like per table? Agreed quality thresholds give reconciliation something to test against.

Approach

Map at field level in the data-migration-mapping template. Each row holds source system, table and column; target table and column by logical name; data type and length; transformation rule; default when blank; whether mandatory; cleansing rule; and the business owner who agreed it. Version the mapping and rebaseline it whenever the data model changes.

Keys and lookups:

  1. Give every migrated table an alternate key holding the legacy identifier, or a composite of source system and legacy identifier where several sources feed one table. Upserting on that key makes loads re-runnable and lets lookups resolve without querying for GUIDs.
  2. For each lookup, define the resolution key and the behaviour when the referenced row is missing: reject the row, link to a documented placeholder, or leave it blank and log it.
  3. Map owners to users or teams with an explicit fallback, and keep the legacy owner value in staging for audit.

Choice columns: build an explicit value map from legacy codes to Dataverse choice values, with a rule for unmapped codes. Map to the integer value, never the label, because labels are translated and renamed. Use global choices where the same list appears on several tables. State and status reason need their own map, since only certain combinations are valid and closed states often have to be set after the row is created.

Cleansing:

  1. Profile before writing rules: null rates, value distributions, invalid formats, orphaned children and suspected duplicates per table. Share the profile with the business so the scale of the problem is visible early.
  2. Deduplicate in staging, before load, using match rules the business has agreed, such as normalised organisation name with postcode, or email address for contacts. Decide which record survives, which fields win, and how children of the losing record are reparented. Have a business user review a sample of proposed merges before any rule is applied in bulk.
  3. Standardise formats: countries and regions to one list, phone numbers to one format, email addresses validated, addresses split into the structured columns.
  4. Decide where each fix happens. Fix at source when only the business knows the answer, by rule in staging when it is repeatable, and after go-live only for low-value fields with a named owner and date.
  5. Minimise. Drop columns no process uses, especially personal data.

Configure Dataverse duplicate detection rules for ongoing data entry after go-live; do not rely on them to clean a bulk load, and check current Microsoft Learn documentation for how they apply to API-based loads.

Outputs

Scale notes

SMB

The consultant usually maps and the customer's administrator or office manager makes the cleansing decisions. Spreadsheet sources are common, and fixing them at source before extract is often fastest. Keep the mapping in one workbook. Do not skip the legacy identifier on each record or the duplicate review; small databases are often the worst for duplicates.

Enterprise

Data analysts own mappings per source, with a data quality lead and named business data owners per table. Expect several sources feeding one customer table, so matching and survivorship rules need formal agreement and possibly a master data management decision. Mappings go under change control, and changes to the data model trigger a mapping impact review.

Hand-offs

Sources

references/sources.md in this skill lists the outside authorities for the questions here, what each is authoritative for, and what you may do with it. Check the current Microsoft Learn documentation before stating how a feature behaves, because Dynamics 365 changes monthly, and cite what you used.

Never

Sources for this skill

Dataverse developer documentation

Requests limits and allocations

UK GDPR guidance and resources

Credit

This skill was created by Simon Foote and Robert Peledie as part of D365Forge, licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Credit them when you share or adapt it; see https://github.com/SimonFoote-greensparx/D365Forge/blob/main/NOTICE.md.