Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Dynamics CRM 2011's addCustomView doesn't work in Chrome and Firefox

Posted on by Microsoft Employee

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

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Dynamics CRM 2011's addCustomView doesn't work in Chrome and Firefox

    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);


  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Dynamics CRM 2011's addCustomView doesn't work in Chrome and Firefox

    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

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Dynamics CRM 2011's addCustomView doesn't work in Chrome and Firefox

    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.

  • Suggested answer
    Andreas Cieslik Profile Picture
    Andreas Cieslik 9,265 on at
    RE: Dynamics CRM 2011's addCustomView doesn't work in Chrome and Firefox

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans