Relationship Mapping (CRM 4.0)
You might have noticed, how certain fields are automatically populated sometimes, whenever a new form is opened from the CRM UI.
Try creating a new Case from the Contract form. The customer and contract fields are automatically populated on the new Case form. Similar to various other entities too.
CRM provides an excellent functionality but often quite ignored by automatically mapping attributes from one entity to another within a 1: many relationships.
Open the CRM window and goto Settings -> Customization -> Contract -> 1:N Relationships -> contract_cases -> Mappings
There are 2 fields already mapped between the contract and case. It is this mapping which defines the fields to be populated when a new Case form is opened from its Parent Form (Contract)
You can use the ‘New’ button to define additional mappings. Mapping is not only related to system attributes, you can define them for custom attributes as well.
Note: Mappings can be defined only for entities within a 1: many relationships
Mapping can be defined for most Entities: Account to Contact, Opportunity to Quote, Quote to Order, Order to Invoice, Contract to Case etc.
So if you try converting a Quote to an Order, you will notice that all fields of the Quote and QuoteDetail are automatically pushed into the SalesOrder and SalesOrderDetail
However consider a scenario, where you need custom fields on QuoteDetail to be transferred to the custom Fields available on the OrderDetail. If you have a look at the QuoteDetail relationships, you will find that no relationship exists between the QuoteDetail and OrderDetail. So how do you go about mapping the custom fields?
Well, CRM definitely has a relationship between the QuoteDetail and OrderDetail Entities, however for some reason unknown, its hidden from the UI.
Here’s an UNSUPPORTED technique to unearth these relationships. So for the above example, we need to transfer QuoteDetail custom attribute values to the OrderDetail Entity.
Within SQL, run the below query:
Select * from entitymapbase where targetentityname = ‘orderdetail’
This query will return 3 items, pick the row with the ‘SourceEntityName’ column value of “quotedetail”.
Copy the GUID value available in the EntityMapId column for this row.
Paste the GUID at the end of the below URL
That opens up the secret mapping page ……
You can use this to map your custom fields as well.