Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
Greetings fellow CRMers!
Nothing spoils the excitement of upgrading your CRM 2011 organization to CRM 2013 like a lousy error. If you’ve experienced this key row error, we’ll tell you how to keep it from ruining your day.
This particular error occurs while the upgrade wizard is processing the upgrade. It may not be flagged as a concern during the validation portion, but the upgrade may fail and the error within the log will state:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object ‘MetadataSchema.AttributePicklistValue’ with unique index ‘ndx_AttributePicklistValue’. The duplicate key value is (c5157c5f-9375-446c-8e8b-1659c0c5d54c, 5, 0, <uniqueorgid>, Jan 1 1900 12:00AM).
This error is due to a few “extra” user CAL license types in the caltype field on the systemuser entity. Specifically the extra CAL types are “Employee Self Service” and “Device Employee Self Service.” These CAL types do not show up on the License Type Option Set on the user form, but you can see them if you look at the caltype field on the systemuser entity. This option set is locked so you cannot remove these options in the CRM field configuration.
In SQL, you can verify these values by running this query against your organization database:
select * from metadataschema.AttributePicklistValue where Optionsetid = ‘c5157c5f-9375-446c-8e8b-1659c0c5d54c’
The results will show more than the standard five license types.
Resolving the Error
NOTE: This blog describes removing values from the CRM organization database using SQL server to solve a very specific issue. As always, make sure you have a good database backup before following these steps.
To resolve the issue, take the following steps.
delete from MetadataSchema.AttributePicklistValue where Value > ’4′ and Optionsetid = ‘c5157c5f-9375-446c-8e8b-1659c0c5d54c’
This will get rid of the extra license types that were preventing you from upgrading, and it should be clear sailing afterward.
If you are facing an issue upgrading your CRM organization to CRM 2013, we’d love to help you through it! Contact us for support, or, if you’d like to sit back and relax, we’ll do it all for you.
The post Duplicate Key Row Error during Upgrade to CRM 2013 appeared first on PowerObjects.