I have heard a repeated question/ complaint from people regarding Alternate key –
- Alternate key does not work sometimes randomly or for some specific combinations.
- Alternate keys do not get activated in target environment on deploying or installing the solution with Alternate key
Alternate keys always work and are in no way random. Alternate keys won’t work in only in below case and is the reason for most of the issues that people face:
When the target environment has data which is not already unique. For example, if you have alternate key on account number which you created in your dev environment., it wont create accounts with duplicate alternate key.
If you are moving this solution to production and there are already accounts with duplicate account number, then your alternate key will not activate. you have to fix the duplicates and then activate the alternate key in this case.
Unfortunately, CRM does not specify the duplicates, so that process of fixing duplicates will be manual.
Note: There is one more issue in accessing Web API/ CRM organization service when you create alternate key with the same name as one of the fields.
Please refer this blog for the details of the issue – http://www.cloudfronts.com/known-issue-when-using-web-api-with-alternate-key-feature/
Please post your comments for suggestions/ clarifications