Dataverse for Architects: Designing with Alternate Keys in Mind

In Microsoft Dataverse, data integrity and uniqueness are critical for building scalable, enterprise-grade apps. While Dataverse ensures every row has a system-generated GUID as its primary key, real-world business scenarios often require natural identifiers like Customer Numbers or Email Addresses to enforce uniqueness.

This is where Keys in Dataverse—both primary and alternate—become essential. In this guide, we’ll deep dive into:

  •  What keys are in Dataverse
  •  Technical details for developers
  •  Strategic insights for architects
  •  Real-world use cases
  •  Limitations and best practices

What Are Keys in Dataverse?

A key in Dataverse defines a column (or set of columns) that enforces uniqueness in a table.

This means no two rows can have the same value for the key column(s).

There are two types of keys in Dataverse:


Primary Key (System-Managed)

  • Every Dataverse table automatically includes a GUID primary key (e.g., `contactid`, `accountid`).
  •  Assigned automatically when a record is created.
  •  Immutable – once created, it never changes.

Example:

`accountid = 15f2b5d0-34d1-4a18-8e42-44c9b33e43a2`

Alternate Keys (User-Defined)

  • Alternate keys let you enforce uniqueness on one or more columns of your choice.
  • They’re great for business identifiers like Customer Numbers, Emails, or SKU Codes.



How to Create Alternate Keys

Step-by-Step

1️⃣ Go to [Power Apps Maker Portal](https://make.powerapps.com)

2️⃣ Select your table (e.g., Account) → Keys tab

3️⃣ Click + New Key

4️⃣ Choose column(s) to define as unique

5️⃣ Save and Publish


Supported Column Types:

  •  Single Line of Text (max 450 chars)
  •  Whole Number
  •  Decimal Number
  •  Lookup (relationships)



 


Best Practices

  • Use alternate keys for external system IDs (e.g., SAP Customer ID).
  • Prefer single-column keys for simplicity and performance.
  • Avoid using fields that frequently change as keys.
  • For composite keys, keep the number of columns minimal.
  • Always test large imports or API calls for duplicate key errors.

Real-World Use Cases

  •  🛒 E-commerce: `SKU` as alternate key for Product table.
  •  🏥 Healthcare: `PatientID` as alternate key for Patient table.
  •  📦 Supply Chain: Vendor or Purchase Order Numbers for integration with ERP.
  •  📧 CRM: `emailaddress1` for deduplication of Contacts.

Summary

Keys in Dataverse are a must-have tool for both developers and architects:

  • Developers – For clean APIs, upserts, and cross-system references
  • Architects – For maintaining data integrity and future-proofing solutions

By mastering keys, you can build enterprise-grade, scalable solutions with confidence.

Comments

Popular posts from this blog

Effective Strategies for Debugging Plugins in Dynamics CRM

Connecting the Dots: FetchXML and Web API Integration in Dataverse

Exploring the Differences: Managed vs. Unmanaged Solutions in Dynamics CRM/Dataverse

L1, L2, and L3 Support Explained

Decode and Fix: “This Data Type is Unsupported for Evaluation” in Power Apps

Model-Driven Apps Command Bar: A Guide to PrimaryControl and SelectedControl

How to Write and Understand a Dynamics CRM Plugin

Stop Struggling with Plugins: Learn IOrganizationService the Smart Way

How Every Plugin Action Travels Through Request, Service, and the Pipeline

Plugin Execution Pipeline Demystified: A Must-Know for CRM Architects