Alternate Keys in Dynamics 365

Leave a comment

When integrating with an external system, the system probably contains a key for records that are being imported. For example, if you are integrating Customers from an ERP system, there is a customer number that defines the uniqueness of the record. In Dynamics 365, the uniqueness of the record is defined by a GUID.

In order to make integrating both systems easier, Dynamics 365 entities have a concept of Keys. The idea is, we can define a key on an entity that will be used by an integrating system. For example, we can create an ERP Customer Number field on the entity. Then, if you are updating or deleting records in an integration, you can look up the record programatically by referencing the new key. In the backend, when you create a key, it creates a database index so the record lookup is optimized.

Let’s go through setting this up.

First, go to Customizations and select the entity you want to create a key on. Create a new field, e.g. ERP Key. Note the key needs to be a whole number, decimal number or a string.

Next, go to Keys:

Select New:

The key status will change from Pending to Active:

You will now be able to reference the key in your integration code.

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *