Tip #897: Alternate key, duplicate data, and solutions: part 2

The alternate key saga did attract some attention and we received the definite say from Brandon Simons, who’s probably as close to the proverbial Dynamics 365 metal as it gets.


Alternate keys can be in an inactive state when the definition is created but the unique index is not. These pending keys can be reactivated using solutions UI in Dynamics 365.

Read more

The best part of the tip deserves a direct quote from Brandon

… feel free to just take credit for yourself as well!

Which is exactly what I’m going to do. Sit back, relax, and enjoy.

Alternate keys are kind of created sync and asynchronously. The synchronous part is just the definition of the alternate key, but the alternate key does not become “active” until the index has been created asynchronously. If a solution is imported that creates an alternate key on a column that has duplicate keys then the solution will import, but the key won’t be active until the data is cleaned up.

The reasoning behind this is that we don’t want to hold up the solution import process as creating the index can take a long time. Also, failing the import isn’t ideal as this is something that is generally pretty easy to fix on the target instance after the solution has been imported. After the alternate key definition is created you will see the key is actually in pending state while the async processing completes:
Pending key
Here is a screenshot where you can view and retry creating the alternate key index if you run into a failure:
Reactivate pending key

Leave a Reply

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