Wednesday, December 8, 2010

Mapping Custom Oppty, Quote and Order Product Attributes

Recently, I had the need to assign a custom category attribute to Quote Products in order to work around some Mail Merge Quote formatting road blocks (I'll discuss this in a later post). I was setting this attribute using Javascript on product selection when a Quote Product was being added to a Quote. This worked fantastically until...the first time I created a Quote from an Opportunity with products already populated.

:: Bang Head! Should have seen that one coming! ::

Ok, so - no problem - just put the script in the Opportunity Product form too, so that no matter the stage of the process (Opportunity or Quote), the category is set when the item is created - right? Sure, and then just map that attribute from Opportunity Product to Quote Product, and voil√°! Mission Accomplished, right?

Unfortunately it was not that easy...

The Goal:
A custom attribute in Opportunity Product, Quote Product, and Order Product Entities that is maintained throughout the life cycle of Opportunity to Quote to Order.

The Hangup:
In Dynamics CRM 4.0, there is no intrinsic way to customize the mappings from Opportunity Product to Quote Product, or from Quote Product to Order Product. The relationship appears not to exist.

The Workaround:
So, off I went to research. Surely I'm not the first person who's had the need to map custom attributes from Opportunity Product to Quote Product. Eventually I found someone doing this from Quote Product to Order Product, and it was suprisingly simple!

As it turns out, a form exists for editing such mappings - there is just no implicit way of accessing it.

The base URL for this form is:

http://[CRMServerAddress]/Tools/SystemCustomization/Relationships/Map pings/mappingList.aspx?mappingId=[GUID]

So, if we can get the GUID of the "mappingList" of interest, we can in theory access those mappings and edit them through this form. For this, we'll go directly to the database. In your favorite SQL client (I use SQL Server Management Studio), run the following queries to get the information you're after:

Opportunity Product to Quote Product
SELECT     *
FROM        entitymapbase
WHERE      targetentityname = 'quotedetail'
Copy the GUID from the opportunityproduct return item


Quote Product to Order Product

SELECT    *
FROM       entitymapbase
WHERE     targetentityname = 'salesorderdetail'
Copy the GUID from the quotedetail return item

With the necessary GUID now at your fingertips, simply complete the URL and paste it into IE, and you'll be rewarded with a mapping configuration form:

No comments:

Post a Comment