We’ve been working with Microsoft Dynamics 2011 CRM for some time. A couple of days ago a big problem came up: our custom fields that we have created on the Opportunity product entity do not mapped to the Quote product entity. This means when you create a Quote from an Opportunity those field values that you added to the Opportunity product entity won’t go through to the Quote.

I was a bit disappointed as I thought to manage the mappings between the Opportunity product and Quote product should be easy as you can set this between the Opportunity and Quote entities. But no! Microsoft hides this for some reason.

So I was looking around on the Internet for how I can solve this. Here is a solution that works for me (please note that these steps work only on hosted CRM because you need access to the Dynamics MS-SQL database, so it does not work on Dynamics 2011 on-line).

1. Login to your MS-SQL server and connect to your MS Dynamics database. The database name should be ORGANIZATION_MSCRM (where ORGANIZATION is your MS Dynamics CRM organization)

2. Run this query that will determine the GUID of the relationship between the Opportunity product and the Quote product:

SELECT EntityMapId
FROM EntityMapBase
WHERE TargetEntityName=’quotedetail’ AND SourceEntityName=’opportunityproduct’;

3. Copy the GUID from your result

4. Open Internet Explorer and go to: http://mycrmserver/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=yourGUIDhere

5. The relationship mapping screen will be available for you on this address and you can create the mapping between these entities.

What about Salesorder product & Invoice product?

The next question was how can I do the same for Sales order Product and Invoice product entities. The answer is the same, you just need to modify your query to get the necessary GUIDs from your database:

For Quote product and Salesorder product:

SELECT EntityMapId
FROM EntityMapBase
WHERE TargetEntityName=’salesorderdetail’ AND SourceEntityName=’quotedetail’

For Salesorder product and Invoice product:
SELECT EntityMapId
FROM EntityMapBase
WHERE TargetEntityName=’invoicedetail’ AND SourceEntityName=’salesorderdetail’

That’s all!