Hi All,
I am trying to implement custom view in lookup field. On a form I am trying to show the products of a particular type. Code :
var onLoad = function (executionContext) {
Xrm.Page.getControl("x_stdcontract").addPreSearch(function () {
addLookupFilter();
});
}
function addLookupFilter() {
var viewId = "{33143774-772F-E511-941A-0050568236F9}";
var viewDisplayName = "PSC";
fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+ "<entity name='product'>"
+ "<attribute name='name' />"
+ "<attribute name='productnumber' />"
+ "<attribute name='productid' />"
+ "<attribute name='externalid' />"
+ "<order attribute='productnumber' descending='false' />"
+ "<filter type='and'>"
+ "<condition attribute='category' value='66' operator='eq'/>"
+ "<condition attribute='type' value='980930000' operator='eq'/>"
+ "</filter>"
+ "</entity>"
+ "</fetch>";
var layoutXml = "<grid name='resultset' object='1' jump='productid' select='1' icon='1' preview='1'>"
+ "<row name='result' id='productid'>"
+ "<cell name='name' width='300' />"
+ "<cell name='externalid' width='150' />"
+ "</row>"
+ "</grid>";
Xrm.Page.getControl("x_stdcontract").addCustomView(viewId, "product", viewDisplayName, fetchXml, layoutXml, false);
}
but still I am not getting the desired result. I am getting those values that were set on that field with a particular system view. But I want to override that system view and have the custom view attached to it.
Please let me know where I am missing it. I think I am too close of solving it.
Thank you.





