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);
};
*This post is locked for comments
Hi,
have you referred the following community thread.
https://community.dynamics.com/crm/f/117/t/123587
It says that the GUID should be in uppercase and they changed the code as follows and it works.
Xrm.Page.getControl(accountLookup).addCustomView(viewId.toUpperCase(), entityName, viewDisplayName, fetchXml, layoutXml, true);
Hi DOSTODEVSKY,
If the multiple browser support is important to you, I would also suggest considering upgrading to the latest version of Dynamics 365.
Microsoft extended support for Dynamics CRM 2011 ends in 2021 but but since you have already started the process best not to stop at a version 6 years old.
https://support.microsoft.com/en-au/lifecycle/search/?p1=15707
More information regarding the level of support.
http://crm.fullscope.com/microsoft-dynamics-crm-support-lifecycle/
Cheers,
Nadeeja
If the answer solves your problem, please mark as Verified. Thanks.
My Blog: http://dyn365apps.com/ - Follow me on Twitter: https://twitter.com/dyn365apps
LinkedIn: https://www.linkedin.com/in/nadeeja
CRM 2011 is not longer supported and there are and will be more and more problems with browsers other than IE. In the 2011 systems that I use I already discovered many features that broke after some browser upgrades (but were working fine at the time when CRM 2011 was still supported version). There will be no more update rollups for that system, so you will have to use IE or just live with the fact that not everything will work flawlessly on every browser. Or if this must work on newest browsers you should consider migrating to the newest version of CRM.
I guess you are using CRM 2011 with Update Rollup 12 or higher, right?
Compatibility with browsers can be checked here:
support.microsoft.com/.../2784954
Secondly, I do recommend not to use the Xrm.Page namespace for own functions.
Instead I would create my own related namespace.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156