One of the challenges when integrating external data with Dynamics CRM is that in order to update a record via the API, you have to know the GUID of the record. Now with the introduction of alternate keys in the CRM 2015 Online Update 1 release, you can use a unique value in your data set as a key for updating records as part of an integration. This will work as long as the data type is an integer (whole number), a decimal number, or a string (single line of text). In today’s blog, we will show you how to utilize these alternate keys in your integrations. Let’s begin!
Say you have a scenario where you have an external system that you want to integrate to your Account entity, and the system uses an email address as its key. You need to define the email address on the Account entity as an alternate key to make the integration easier to write and run faster. In order to do this, follow the steps below.
1. First, navigate to your solution and add the existing Account entity (if applicable). Then navigate to the Keys attribute of the Account entity and click New.
2. Next, select the field you want to use as a key, click Add, and give it a Display Name. Click Ok.
3. The system will then create a database index on that field to ensure fast querying and enforce the uniqueness of the values. Depending on how much data you have in your database, this could take a while. While this is processing, the key’s status will be either Pending or In Progress.
4. When the indexing operation is complete, the key’s status will change to Active. Congratulations! Your new key is ready for use!
You can use this key for Update and Upsert operations via the SDK. For further information on alternate keys, check out the MSDN article here: https://msdn.microsoft.com/en-us/library/dn932139.aspx.
That’s all for today, readers! If you’re interested in learning more about Dynamics CRM, consider attending this year’s PowerUp conference November 10-11, with a PowerUp Hands-On Day on November 12. This educational extravaganza is the CRM event of the year and is open to beginners and advanced users. PowerUp is a can’t-miss CRM event! We hope to see you there!