Wednesday, 19 October 2016

Importing Solution and fixing attribute maps failures On Premise


Since the "EASY TO USE" is not a feature of the Error Log in Microsoft CRM Dynamics. Today i`m explaining in terms of attribute maps failures how can we detect the guid that show on the error log.
In most cases this issue shows up while we import a solution like for example a new version. Caused by the fact that someone has created an Unmanaged Solution and on this unmanaged solution has created an relationship with one of the entities/fields that exist on the Managed solution. the one i'm trying to import. In my case this is the most common issue and we need to identify what mapping was created so we can delete it. Just one note please DO NOTE REMOVE THE UNMANAGED SOLUTION, that will not work.
Sorry, but sometimes i get a bit nervous :D.
Now, deleting the unmanaged solution will not delete the relationship or mapping, an unmanaged solution is like a pointer, deleting that will not delete what was created (entities, fields, mappings, etc) and you lose the track of it. So... before we delete the mapping or relationship do a note for yourself that maybe needed to be created later or has the best practice we should be putting that change in the managed solution, depending on the product and you will not be doing that on Field One, ClickDimensions‎ or Adxstudio, only on your own solutions.

Beside the below script in SQL can only run On-Premise, I know that is also possible to it in CRM Online version but i didn't spend to much time on  and maybe i will change this post later and put also the code here, but in order to do that you need to create a console application.

Is something of this kind (quick search on google):

<fetch version='1.0' mapping='logical' distinct='false'>
<entity name='entitymap'>
<attribute name='sourceentityname'/>
<attribute name='targetentityname'/>
<link-entity name='attributemap' alias='attributemap' to='entitymapid' from='entitymapid' link-type='inner'>
<attribute name='sourceattributename'/>
<attribute name='targetattributename'/>
</link-entity>
</entity>
</fetch>

So, here is the SQL query to use to find the mapping based on the GUID that the CRM has given.

select TargetAttributeName, SourceAttributeName, EntityMapID
from AttributeMapm
where AttributeMapId='AttributeMapIDGUIDGoesHere'
Select TargetEntityName
from EntityMapBase
where EntityMapId = 'EntityMapIDGUIDGoesHere'

Thanks and i hope this helps you.

No comments:

Post a Comment