title: Retrieve all the entities via SOAP in Javascript (CRM 2011)
body: <p>With the following SOAP query I'm trying to get all the entities in the solution but it doesn't return entity. Maybe a second eye could help. Do you see anything wrong that I can't see? Thank you !</p>
  
  <pre><code>JCL.RetrieveAllEntitiesRequest = function (fnCallBack) {
          /// Returns a sorted array of entities
          var request = "";
          request += "&lt;s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;";
          request += "  &lt;s:Body&gt;";
          request += "    &lt;Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;";
          request += "      &lt;request i:type=\"a:RetrieveAllEntitiesRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"&gt;";
          request += "        &lt;a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\"&gt;";
          request += "          &lt;a:KeyValuePairOfstringanyType&gt;";
          request += "            &lt;b:key&gt;EntityFilters&lt;/b:key&gt;";
          request += "            &lt;b:value i:type=\"c:EntityFilters\" xmlns:c=\"http://schemas.microsoft.com/xrm/2011/Metadata\"&gt;Entity&lt;/b:value&gt;";
          request += "          &lt;/a:KeyValuePairOfstringanyType&gt;";
          request += "          &lt;a:KeyValuePairOfstringanyType&gt;";
          request += "            &lt;b:key&gt;RetrieveAsIfPublished&lt;/b:key&gt;";
          request += "            &lt;b:value i:type=\"c:boolean\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\"&gt;true&lt;/b:value&gt;";
          request += "          &lt;/a:KeyValuePairOfstringanyType&gt;";
          request += "        &lt;/a:Parameters&gt;";
          request += "        &lt;a:RequestId i:nil=\"true\" /&gt;";
          request += "        &lt;a:RequestName&gt;RetrieveAllEntities&lt;/a:RequestName&gt;";
          request += "      &lt;/request&gt;";
          request += "    &lt;/Execute&gt;";
          request += "  &lt;/s:Body&gt;";
          request += "&lt;/s:Envelope&gt;";
  
          return JCL._ExecuteRequest(request, "Execute", JCL._RetrieveAllEntitiesResponse, fnCallBack);
      };
  
  JCL._ExecuteRequest = function (sXml, sMessage, fInternalCallback, fUserCallback) {
          'use strict';
  
      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open("POST", JCL.server + "/XRMServices/2011/Organization.svc/web", (fUserCallback !== null));
      xmlhttp.setRequestHeader("Accept", "application/xml, text/xml, */*");
      xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
      xmlhttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/" + sMessage);
  
      if (fUserCallback !== null) {
          // asynchronous: register callback function, then send the request.
          xmlhttp.onreadystatechange = function () {
              fInternalCallback.call(this, xmlhttp, fUserCallback);
          };
  
          xmlhttp.send(sXml);
      } else {
          // synchronous: send request, then call the callback function directly
          xmlhttp.send(sXml);
          return fInternalCallback.call(this, xmlhttp, null);
      }
  };
  </code></pre>
  
  <p>Update after @Paul Way replied to me:
  This is the error message I get when I select the entity that I need to investigate in CRM Data Detective. I can't add any field to this entity that's why I am using CRM Data Detective to find out which field I could delete, but it happens that the solution couldn't also handle an entity with a maximum number of attributes. Could you please have a look Paul? thank you So much !</p>
  
  <p><img src="https://i.stack.imgur.com/L37sj.png" alt="enter image description here"></p>