PL 400 : create and use alternate key (Implement data synchronization)
Alternate key is not a new concept, it is available in the database which considers it as an alternative of primary key. Normally, a primary key is only one column in a table, but columns that can be replaced to a primary but not a primary key are called alternate keys. Whereas, primary key does not hold null values and maintain uniqueness, but in alternate keys, it contains null values with uniqueness.
Primary key is already implemented in all Microsoft Dataverse records, it maintains uniqueness by unique identifiers defined as GUIDs, but Microsoft also provides a alternate key to integrate with an external data store, we might be able to add a column to the external tables to contain a reference to the unique identifier in Dataverse.
With alternate keys, we can define column in Customer Engagement table to correspond to unique identifier or unique combination of columns used by the external data store.
Common Requirements:
- Link records from external system to Dataverse without modify external system schema.
- Eliminate duplicate records.
Database Table columns supported for Alternate Key:
- Decimal Number
- Whole Number
- Single Line of text
- Datetime
- Lookup
- Option set
To Create the Alternate Key:
- Login on https://make.powerapps.com portal
- Go on Dataverse Table either enter directly by Dataverse option or Use Solution (Best practice to use solution).
- Under the Dataverse table, Click on the Keys.
- Click the Add Key options, Add Key popup will appear
For creation of Alternate key, A key must contain at least one column.
Important points:
- 16 columns per key
- Total key size does not violate SQL based index constraints like 900 bytes per key.
- 10 alternate keys par table definitions
- Alternate keys use database indexes to enforce uniqueness and optimize lookup performance.
- If the data within a column that is used in an alternate key will contain one of the following characters /,<,>,*,%,&,:,\\,? then retrieve (GET), update or upsert (PATCH) actions will not work.
I got some valuable points through this blog.
ReplyDeleteWS-050T00: Migrating Application Workloads to Azure