this.addMQtoPriceListItemFilter = function (ExecutionContext, dfltPxLstId, MQpxLstId) { formContext = ExecutionContext.getFormContext(); Products_in_Parent_Price_List_savedqueryid = "BCC509EE-1444-4A95-AED2-128EFD85FFD5"; Products_in_both_Price_Lists_savedqueryid = "990143DD-7576-E911-A96A-000D3A4E75C3"; //dummied fetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" + "<entity name='product'>" + "<attribute name='name' />" + "<attribute name='price' />" + "<attribute name='defaultuomid' />" + "<attribute name='productnumber' />" + "<attribute name='productid' />" + "<order attribute='productnumber' descending='false' />" + "<filter type='and'>" + "<filter type='or'>" + "<condition attribute='statecode' operator='eq' value='0' />" + "<condition attribute='statecode' operator='eq' value='3' />" + "</filter>" + "</filter>" + "<link-entity name='productpricelevel' from='productid' to='productid' link-type='inner' alias='aa'>" + "<filter type='and'>" + "<condition attribute='pricelevelid' operator='in'>" + "<value uitype='pricelevel'>{" + dfltPxLstId + "}</value>" + "<value uitype='pricelevel'>{" + MQpxLstId + "}</value>" + "</condition>" + "</filter>" + "</link-entity>" + "</entity></fetch>"; Xrm.WebApi.retrieveRecord("savedquery", Products_in_Parent_Price_List_savedqueryid, "?$select=layoutxml").then( function success(result) { if (result.layoutxml) formContext.getControl("productid").addCustomView(Products_in_both_Price_Lists_savedqueryid, "product", "Products in both Price Lists", fetchXML, result.layoutxml, true) }, function (error) { formContext.ui.setFormNotification("Product view: " + error.message, "ERROR", "_Products_in_Parent_Price_List"); } ); };
-------------------------------------------
This is loaded against an opportunityProduct quick create form on the Existing Product (productid) field:
- the view does not become default; defaults to top of the list
- in the selector it shows as a personal view
- when chosen it doesn't list the correct items (I've tested the fetch in both Advanced find and FetchTester)
Any ideas why?
thanks,
*This post is locked for comments