Thursday 19 July 2012

Dynamics CRM 2011 - Odd behaviour of Product default lookup view on Order Product record

Yesterday, I faced a weird behaviour of order product entity on production server & in fact did not visualize the same during development phase. This is related to a default lookup view of existing product on Order Product entity record.

In Dynamics CRM a default lookup view for this entity is “Products in Parent Price List”. Means you will only be allowed to select the products of Price List that was selected on Order record (Parent record). On yesterday I found that the default view was changed to “Product Lookup View” and it now allows you to select products of all Price Lists. Weird….

After goggling for an hour I came to know that this is because I wrote some JavaScript code on change event of this lookup field to do some calculation of pricing based on product selection. So when you write custom code on the OnChange event of such "special" lookups CRM loses its normal behaviour.


  • Create a new temporary unmanaged solution on development organization.
  • Add an Order Product entity to this solution.
  • Export this solution as unmanaged.
  • Unzip the customization files.
  • · In customiztaion.xml, change the default view GUID back to “Products in Parent Price List” ({BCC509EE-1444-4A95-AED2-128EFD85FFD5}) by replacing the current GUID of “Product Lookup” ({{8BA625B2-6A2A-4735-BAB2-0C74AE8442A4}}).
  • Import the solution back to the development organization & publish the changes.
  • You can now validate the default lookup view for Product lookup.
  • Now, export your original unmanaged solution as Managed to be imported on production server.

Referred links


  1. I believe that it would be easier if we change the default view in the field properties, isn't it ?

  2. Hello Mostafa,

    Thank you for your response.

    Can I know from where we can setup the defaul view?

    As far as I know, there is no provision at field level for such customization.
    Also, you can only set the public views as the default view.

  3. Hello Ankit,
    I removed the code on the change event but the behavior is still the same, i get all the products listed outside of the selected price list. So I am really not sure that by adding some on change code the behavior is changed. can you share any specific links on this.

  4. Hello Sarfaraz,

    Out-of-the-box this lookup should only display the products of parent price list. So, if you are getting all the products listed outside of the selected price list then please follow the steps specified on above. After applying the workaround you would be able to see the parent price list products only.

  5. Thanks Ankit, brilliant find. Solution working perfectly.

  6. This fixed the issue thank you. However, now I am back to the default unit not automatically populating. How can I get the UOM to populate automatically without loosing the Lookup?

  7. Hello Mr. Garabed,

    According to my knowledge, the Unit lookup(UOM) gets enabled based on the selection of the product. System automatically updates the value of unit based on product value change.

    If you want then you can write JavaScript code on change on product selection that auto populates unit value with the default unit value of selected product.

    I hope this would be helpful.

    1. Maybe I am not understanding this correctly but that is what I did. I placed a java onchange on the productid of the sales order form so when a product is selected it automatically enters the UOM in the field. When I do this I loose the Products in Parent Price List.

    2. Hello Mr. Garabed,

      That's true. That is what explained above as odd behaviour of product lookup. You need to apply the workaround part once you are done with all your on change scripting.

  8. I would recommend pushing the Price List lookup value from the Order to the Order Product form and adding a custom view to the ProductId field on load of the form using javascript. This avoids any direct editing of the XML while also providing control over the look and feel of the view. Key steps: 1. create Price List on Order Product form, 2. ensure the Price List fields are mapped between Order and Order Product, 3. create a formload javascript that uses the 'addcustomview' method for crm controls, 4. ensure the form load event triggers the javascript

  9. I am having the same issue now with my Quote Product Entity. I am assuming the solution is similar. Do you know if the default GUID in customization.xml would be changed to the same value in or example?

  10. This Solution worked until Rollup 14. Seems that Microsoft has now hidden the View...
    In customiztaion.xml, change the default view GUID back to “Products in Parent Price List” ({BCC509EE-1444-4A95-AED2-128EFD85FFD5}) by replacing the current GUID of “Product Lookup” ({{8BA625B2-6A2A-4735-BAB2-0C74AE8442A4}}).