In Microsoft Dynamics 365, importing a CRM 2016 solution containing the same Business Process Flows that have been modified on the target to add new entity stages fails

This article provides a solution to an error that occurs when importing CRM 2016 solutions.

Applies to:   Microsoft Dynamics CRM
Original KB number:   4034927

Symptoms

On a Dynamics 365 organization, when importing CRM 2016 solutions that contain the same Business Process Flows(OOTB or custom ones) that have been customized on the target with new stages on other entities, a new layer is attempted to be created over the existing one that results in the following error:

A managed solution cannot overwrite the Attribute component with Id=<attributeid> which has an unmanaged base instance. The most likely scenario for this error is that an unmanaged solution has installed a new unmanaged Attribute component on the target system, and now a managed solution from the same publisher is trying to install that same Attribute component as managed. This will cause an invalid layering of solutions on the target system and is not allowed.

Cause

In Dynamics 365 during solution import, if we detect that the solution being imported is of a version older than Dynamics 365, and if it contains any Business Process Flows, we inject the corresponding Business Process Flow entity in to the incoming solution package so that it creates it appropriately to adhere to the new paradigm of Business Process Flows that are now represented as first class entities in Dynamics 365. However, in this customization scenario, since a new entity stage was added, during solution import a new solution layer is attempted to be created for this new entity stage where we attempt to disable the associated lookup attribute. Here a managed solution is trying to modify an asset that already exists on the target environment and is owned by the active layer. It's a known limitation.

Resolution

Remove your active customizations, import the previously failing solution and then readd your customizations back again.

To elaborate further, let's use an example. Say you have a Business Process Flow on the Account entity called BPF1. On your Dynamics 365 org., you modify BPF1 to add another stage, but on the Contact entity. In this case, if you import a CRM 2016 solution containing the original version of BPF1 (optionally with some other modifications but not including this Contact entity stage), the import will fail with the error called out above. In this case, do the following steps:

  1. Backup BPF1 by exporting it out as an unmanaged solution.
  2. Go to CRM -> Settings -> Processes -> BPF1.
  3. Delete the new stage you added on the Contact entity.
  4. Select the Update button on the top left of the designer to save the changes.
  5. Now import the CRM 2016 solution and it should succeed.
  6. Import the unmanaged solution that you exported in step 1 above.