When working with Dataverse, understanding Primary Keys, Primary Name Columns, and Alternate Keys is essential for designing efficient and user-friendly applications. This blog post explores the differences between these concepts, their use cases, and how alternate keys can significantly improve our workflows, especially in scenarios like external integrations and relational lookups. We will use two Dataverse tables Student and Admission Record to understand them.
Please note that “This text content of this blog post was drafted with the assistance of ChatGPT and I have reviewed every word and sentences and verified the content with practical implementation and screenshots.”
A Primary Key is a system-generated unique identifier for each record in a Dataverse table. It is essential for maintaining uniqueness and enabling relationships between records across tables.
Student
, the Primary Key is the column Student which contains GUID like f9318676-17cc-ef11-a72e-7c1e520ed992
.The Primary Name Column is a human-readable field that acts as the default identifier for a record in the user interface of Dataverse. While it is not a unique identifier by default, it represents the record in views, searches, and other UI interactions.
Name
, Student Name
).Student
table, the Primary Name Column is Student Name
, showing values like Stephen
or James
.Feature | Primary Key | Primary Name Column |
---|---|---|
Uniqueness | Always unique. | Not necessarily unique (unless configured). |
Purpose | Backend identifier for system use. | UI-friendly identifier for user reference. |
System-Generated | Automatically created (GUID). | User-defined and customizable. |
Editable | Immutable. | Editable by users (field data). |
Type | GUID | Text, numeric, or other formats. |
Use Case | Relational lookups, integrations. | Display in views, searches, and forms. |
While the Primary Key ensures system-level uniqueness, the Primary Name Column makes records human-readable and user-friendly in the interface. They serve complementary but distinct purposes in Dataverse.
An Alternate Key is a user-defined unique identifier for records in a Dataverse table. It provides a meaningful way to identify records using one or more columns. Alternate keys are particularly useful for integrations, lookups, and scenarios where human-readable identifiers are needed.
In the Student
table where each student has a unique Registration Number
(logical name: blog_registrationnumber
), we can define an alternate key on the
column. Now, instead of using the GUID to reference a student, you can use Registration Number
. For example, in an API call, you can use Registration Number
/students(blog_registrationnumber="RID-101")
to fetch the student directly.
Feature | Primary Key | Alternate Key |
---|---|---|
Uniqueness | Always unique. | Always unique. |
Human-Readable | Not human-readable (GUID). | Often human-readable (e.g., ID). |
Purpose | System-generated identifier. | User-defined meaningful identifier. |
Use Case | Internal relationships and lookups. | External integrations, relational references. |
Configuration | Automatically created by Dataverse. | Configured manually by the user. |
Registration Number
).To demonstrate the utility of alternate keys, let’s consider a real-world example involving two tables: Student and Admission Record. The Admission Record table has a lookup column referencing the Student table. We will try to update a an admission record with the student name.
When working without alternate keys, relationships between tables are established using GUIDs. Here’s how the process typically works when we try to update a look up field without using alternate key. It usually takes 3 steps: First get the student record using the regisration number, extract the GUID from the record and use the GUID to update the student field.
eq 'RID-101
‘GUID
from the response.Student
lookup field using the GUID.Hence, /blog_students(Odata Row ID from dynamic content).
Once this flow is executed successfully, we will see the Admission Record e4b2cd8b-9a8f-4e96-b1db-74f806aff77a has Student field populated.
By introducing an alternate key, such as Registration Number Alternate Key
, the process becomes significantly more efficient. Here’s how it works:
Student
lookup field.Example in Power Automate
The modified flow is shown below:
Here the difference we can see is that instead of passing the GUID, we are now using the Registration Number field and passing the human-readable value to it.
When this flow is run, we can see that the second Admission Record has been updated with the student Smith whose registration number is 102.
Benefits:
Registration Number
for clarity.Below are some of the additional usage I have found out from across the internet and through ChatGPT.
EmployeeID
or OrderNumber
.OrderNumber
. The alternate key OrderNumber
in Dataverse allows direct referencing like /orders(OrderNumber="ORD12345")
in API requests.LegacyCustomerID
) remain valid and enforce uniqueness./blog_students(blog_registrationnumber="RID-101")
), simplifying the API design.Using alternate keys in Dataverse can greatly simplify data operations, improve integration workflows, and make relational references more intuitive. While Primary Keys (GUIDs) serve as the backbone for internal record management, alternate keys provide a human-readable, efficient alternative for external integrations and user-facing scenarios.
By implementing alternate keys in your Dataverse tables, you can ensure streamlined data handling and optimized performance across all your applications.
Let me know what you feel about this post in the comment section or if you would like to see the use of Alternate Keys in any other scenarios. Thank you!
Check James Yumnam’s original post https://jamesyumnam.com/2025/01/07/demystified-the-alternate-keys-in-dataverse-tables/ on jamesyumnam.com which was published 2025-01-07 11:40:00