POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

Greetings fellow CRMers!

troubleshooting

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).

Reason for the Error

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.

Duplicate Key Row Error while upgrading to CRM 2013

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.

  1. Take a backup of your database.
  2. Run the following query:

    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.

Happy CRM’ing!

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.