1

I'm receiving this error when importing an unmanaged solution from Dynamics CRM 2016 to a clean instance of Dynamics 365. There are no other details so I don't know which specific entity is having a problem

Cannot insert duplicate key row in object 'dbo.DependencyBase' with unique index 'ndx_UniqueDependencyNodes'. The duplicate key value is (b8e82bca-64b2-4b4c-9192-0eb2010de885, a5396ca9-d5fa-4951-ba3f-619bb8fab0b7). The statement has been terminated.

Has anyone encountered this before?

The Dynamics CRM 2016 version is (8.1.0.569) (DB 8.1.0.563)

[Update] Both CRM 2016 and Dynamics 365 are online instances.

2 Answers2

3

This is a bug in the current Dynamics 2016 product. Microsoft is working on a solution.

The import process of solutions in CRM can create inconsistencies in the organization database that can only be fixed by SQL scripts. This in itself is unsupported and cannot be done on Dynamics 365/OnLine.

I recently had similar issues regarding the CustomControlDefaultConfig entity.

This specific issue concerning the DependencyBase table may be solved with the following SQL script:

delete from
    DependencyBase
where
    DependencyId in
    (
        select
            d.DependencyId
        from
            Dependency d
            left join CustomControlDefaultConfig dc
                on d.DependentComponentObjectId = dc.CustomControlDefaultConfigId
            left join CustomControlDefaultConfig rc
                on d.RequiredComponentObjectId = rc.CustomControlDefaultConfigId
        where
            (d.DependentComponentType = 68 and dc.CustomControlDefaultConfigIdUnique is null)
            or (d.RequiredComponentType = 68 and rc.CustomControlDefaultConfigIdUnique is null)
);

NOTE

Executing this script on the CRM database is an unsupported action. Make a database backup first and use it at your own risk.

Henk van Boeijen
  • 7,357
  • 6
  • 32
  • 42
  • Thanks for the answer but I forgot to mention these are both CRM Online. One is still 2016 while the other is a new instance of Dynamics 365 – Gildon Opao Mar 14 '17 at 06:05
  • 1
    In that case you need to contact Microsoft Support. Still, if you think this answer is useful, consider giving it a vote. :-) – Henk van Boeijen Mar 14 '17 at 06:15
0

For me the problem was with an SLA that was included in the solution.

My situation was this:

-Develop and customize on an online PROD instance (before go-live) - collecting all the customizations in one solution

-Copy (redeploy) from this PROD to two sandbox instances

-Export solution from one sandbox to another or back to the PROD instance

I corrected the problem by decativating and then deleting the SLA from the target system.

Since then my solution can be imported repeatedly with the SLA in it, even when the target system has the SLA as default and active.

Ronda
  • 1
  • 2