Thursday, January 15, 2015

Soap Retrieve Entity Request

RetrieveEntityRequest = function (logicalName, fnSuccessCallback, fnErrorCallback) {
/// Returns a sorted array of entities
var request = "";
request += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
request += "  <s:Body>";
request += "    <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
request += "      <request i:type=\"a:RetrieveEntityRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
request += "        <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
request += "          <a:KeyValuePairOfstringanyType>";
request += "            <b:key>EntityFilters</b:key>";
request += "            <b:value i:type=\"c:EntityFilters\" xmlns:c=\"http://schemas.microsoft.com/xrm/2011/Metadata\">Entity Attributes Privileges Relationships</b:value>";
request += "          </a:KeyValuePairOfstringanyType>";
request += "          <a:KeyValuePairOfstringanyType>";
request += "            <b:key>MetadataId</b:key>";
request += "            <b:value i:type=\"ser:guid\"  xmlns:ser=\"http://schemas.microsoft.com/2003/10/Serialization/\">00000000-0000-0000-0000-000000000000</b:value>";
request += "          </a:KeyValuePairOfstringanyType>";
request += "          <a:KeyValuePairOfstringanyType>";
request += "             <b:key>LogicalName</b:key>";
request += "             <b:value i:type=\"c:string\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\">" + logicalName + "</b:value>";
request += "          </a:KeyValuePairOfstringanyType>";
request += "          <a:KeyValuePairOfstringanyType>";
request += "            <b:key>RetrieveAsIfPublished</b:key>";
request += "            <b:value i:type=\"c:boolean\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\">true</b:value>";
request += "          </a:KeyValuePairOfstringanyType>";
request += "        </a:Parameters>";
request += "        <a:RequestId i:nil=\"true\" />";
request += "        <a:RequestName>RetrieveEntity</a:RequestName>";
request += "      </request>";
request += "    </Execute>";
request += "  </s:Body>";
request += "</s:Envelope>";

return _ExecuteRequest(request, "Execute", .RetrieveEntityResponse, fnSuccessCallback, fnErrorCallback);
};

No comments:

Post a Comment