Friday, July 27, 2012

Convert Entities to Managed Solution Fails

After Microsoft CRM 2011 Rollup 6 you might be facing a problem when you try to import a solution as managed where the target system contains those entities as unamnaged.

The process of converting entities to managed solution fails if you have custom attributemaps.
The error you get is similar to the following.
Found 1 dependency records where unmanaged component is the parent of a managed component. First record (dependentcomponentobjectid = 6d680c43-f66c-e111-a4d0-005056b20fcf, type = AttributeMap, requiredcomponentobjectid = 58765635-f66c-e111-a4d0-005056b20fcf, type= EntityMap, solution = 559bf67b-6e7a-4b68-a4a2-efa4b8fffdd1).
This scenario can happen after you upgrade from CRM 4.0 to CRM 2011 and you have your ISV solution in CRM 4 that you now want to be a managed solution in CRM 2011.

Consider this scenario:
You have a system with entity E3 and entity E4
Entity E3 is the parent of entity E4
The N:1 relationship contains an attribute mapping between the name fields
If you first install this solution as unmanaged, and then try to install it as a managed solution the conversion to managed solution fails on the dependency check
With an error simular to this:
Found 1 dependency records where unmanaged component is the parent of a managed component. First record (dependentcomponentobjectid = 6d680c43-f66c-e111-a4d0-005056b20fcf, type = AttributeMap, requiredcomponentobjectid = 58765635-f66c-e111-a4d0-005056b20fcf, type= EntityMap, solution = 559bf67b-6e7a-4b68-a4a2-efa4b8fffdd1).
To reproduce the issue take the following steps:
Step 1: import the unmanaged solution and publish all.
Step 2: delete the solution,(not the entities) so you can import the managed solution.
step 3: import the managed solution.
Result: This fails. (Before Rollup 6 it works)


You use these solutions at your on risk! Make sure you try it out first in a dev environment so that you can confirm you get the result you want from it. Always make sure you have backups!


Solution 1
If you remove the attribute mappings from the managed solution the import works in your environment.
Drawback: If you want to continue to install new versions of you managed solution in to the target system it will fail if you have attributemappings in the managed solution.

Solution 2
Remove the custom attributemaps in the target system from the entities you want to convert to managed.
Import the managed solution without your custom attributemaps.

Edit the solution.xml in you managed_solution.zip file to comment out the extra attributemaps and then create a new manages_solution.zip


Once the entities is converted to managed you can do a second import this time with your custom attributmaps.

Select overwrite customization


From now on you will be able to import new versions of your solution without making any changes to the attributemaps.

Drawback: You need to know some XML and be careful!

1 comment:

  1. It is a great website.. The Design looks very good.. Keep working like that!. bet9ja mobile

    ReplyDelete