Define alternate keys to reference Dynamics 365 records

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

With alternate keys, you can assure an efficient and accurate way of integrating data into Microsoft Dynamics 365 from external systems. It’s especially important in cases when an external system doesn’t store the Dynamics 365 record IDs (GUIDs) that uniquely identify records. The alternate keys are not GUIDs and you can use them to uniquely identify the Dynamics 365 records. You must give an alternate key a unique name. You can use one or more entity fields to define the key. For example, to identify an account record with an alternate key, you can use the account name and the account number. You can define alternate keys in the Dynamics 365 web application without writing code, or you can define them programmatically. Note that while you can define the alternate keys in the user interface (UI), they can only be used programmatically, in code.

Some of the benefits of the alternate keys feature include:

  • Faster lookup of the records.

  • More robust bulk data operations, especially in Dynamics 365 (online).

  • Simplified programming with data imported from external systems without Dynamics 365 record IDs.

To learn more about alternate keys programmability, see:
MSDN: Define alternate keys for an entity
MSDN: Use an alternate key to create a record

Define the alternate keys

To define the alternate keys, go to Go to Settings > Customizations.. Choose Customize the System > Components > Entities > Entity <X> > Keys. Choose New. On the form, fill in the required fields (Display Name and Name) and then choose and add the fields to the key. Save the key. In the example shown here, we used the Account Number field in the alternate key definition.

Define alternate key for the account entity

Note

You can define up to five different keys for an entity.

See Also

Customize your Dynamics 365 system
Create and edit web resources
MSDN: Define alternate keys for an entity
MSDN: Use an alternate key to create a record

© 2016 Microsoft. All rights reserved. Copyright