Hello;
We're in the process of migrating our Dynamics CRM 4.0 to CRM 2011. We are using Stunnware extension to filter the lookups.
After we've found out that filtered views are supported out of the box in CRM 2011, we decided to use them. Our new lookups work fine in Internet Explorer but not in Chrome (Version 55.0.2883.87 m (64-bit)) or Firefox (52.0a2 (2016-12-28) (32-bit)).
No errors are thrown in Console (Although we were getting "Refused to set Content-Length header" error and had to remove the header from th "C:\Program Files\Microsoft Dynamics CRM\CRMWeb\_static\_common\scripts\Global.js" file).
Our code looks like this (pretty standard stuff, nothing fancy):
Xrm.Page.setAccountFilteredLookup = function (accountLookup, resetSelection) {
//availableDefaultViewId = Xrm.Page.getControl(accountLookup).getDefaultView();
// if reset selection = true
if (resetSelection == true) {
// reset old selection accountFieldName
Xrm.Page.getAttribute(accountLookup).setValue(null);
}
// use randomly generated GUID Id for our new view
var viewId = "{6fd72744-3676-41d4-8003-ae4cde9ac282}";
var entityName = "account";
// give the custom view a name
var viewDisplayName = "Comptes candidats ou clients " + "";
// customertypecode client ou candidat
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
"<entity name='account'>" +
"<attribute name='name'/>" +
"<attribute name='accountnumber'/>" +
"<attribute name='accountid'/>" +
"<attribute name='createdon'/>" +
"<attribute name='customertypecode' />" +
"<order attribute='accountnumber' descending='false'/>" +
"<filter type='or'>" +
"<condition attribute='customertypecode' operator='eq' value='200001' />" +
"<condition attribute='customertypecode' operator='eq' value='200002' />" +
"</filter>" +
"</entity>" +
"</fetch>";
// build Grid Layout
var layoutXml = "<grid name='resultset' " +
"object='1' " +
"jump='accountid' " +
"select='1' " +
"icon='1' " +
"preview='1'>" +
"<row name='result' " +
"id='accountid'>" +
"<cell name='accountnumber' " +
"width='200' />" +
"<cell name='name' " +
"width='200' />" +
"<cell name='customertypecode' " +
"width='200' />" +
"<cell name='createdon' " +
"width='100' />" +
"</row>" +
"</grid>";
// add the Custom View to the account lookup control
Xrm.Page.getControl(accountLookup).addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
};