Monday, August 27, 2012

Displaying Related Opportunity Products on a CRM 2011 Account Record

Seems like it should be so easy, but when you try to add a sub-grid to the Account form it starts becoming a bit harder. When choosing to display Related Records, there is no out of the box relationship to Opportunity Products. When you choose All Record Types, the only view you have to choose from is All Opportunity Products. Obviously neither option works.
Solution:
  1. On Opportunity Product, create a new N:1 Relationship between Account and Opportunity Product
  2. On Opportunity, under the 1:N Relationships find the the relationship between Opportunity and Opportunity Product, add a new mapping between Opportunity ‘customerid’ and Opportunity Product ‘new_accountid’ (or whatever you called it)
  3. On your Account form add your sub-grid, now you should be able to select:
    • Records: Only Related Records
    • Entity: Opportunity Products (Account)
    • Default View: All Opportunity Products
  4. Save and Publish everything
So now behind the scenes when you create an Opportunity Product, the field created as a result of the new relationship gets populated with the related Account when the record is created (it is your choice to add it to the form or not).
OpportunityProducts
The same process should also work for Quote, Order and Invoice Products and well as Contacts. You would just need to create the additional relationships and mappings.
Keep in mind, this does not provide any kind of filtering so if you have the same Product related to multiple Opportunity Products, you will see it listed multiple times.