title: CRM 2011 - addCustomView on Google Chrome
body: <p>I have been on a CRM 2011 project that uses a lot of custom views. </p>
  
  <p>I recently figured it out that all lookup custom views are only working properly in the internet explorer. When I try using google chrome (Version 51.0.2704.84 m) it simple does not work.</p>
  
  <p>I googled without luck. </p>
  
  <p>Is anyone aware about how to solve that issue? </p>
  
  <p>I'm sure many of you have faced the same problem.</p>
  
  <p>Here is my code. I emphasize that it works like a charm in IE.</p>
  
  <pre><code>    var viewId = "{1DFB2B35-B07C-44D1-868D-258DEEAB88E1}";
      var entityName = "tz_tipodefrete";
      var viewDisplayName = "Tipos de Frete Disponíveis";
  
      var fetchXml =
  "&lt;fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'&gt;" +
      "&lt;entity name='tz_tipodefrete'&gt;" +
          "&lt;attribute name='tz_name'/&gt;" +
          "&lt;order descending='false' attribute='tz_ordem'/&gt;" +
          "&lt;filter type='and'&gt;";
      if (filtrar)
          fetchXml = fetchXml + "&lt;condition attribute='tz_name' value='Cliente Retira e instala no CT' operator='ne'/&gt;";
  
      fetchXml = fetchXml +
              "&lt;condition attribute='statecode' value='0' operator='eq'/&gt;" +
          "&lt;/filter&gt;" +
      "&lt;/entity&gt;" +
  "&lt;/fetch&gt;";
  
      // build Grid Layout
      var layoutXml = "&lt;grid name='resultset' object='1' jump='tz_name' select='1' icon='1' preview='1'&gt;" +
                        "&lt;row name='result' id='tz_tipodefreteid'&gt;" +
                          "&lt;cell name='tz_name' width='600' /&gt;" +
                        "&lt;/row&gt;" +
                      "&lt;/grid&gt;";
  
  
      Xrm.Page.getControl("tz_tipodefrete").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
      //Desabilita a opção do usuário trocar de view. Provável que pare de funcionar na migração para versão 2015
      document.getElementById("tz_tipodefrete").setAttribute("disableViewPicker", "1");
  </code></pre>