18 var header = GenerateAuthenticationHeader();
19 var userid = "838975f4-029c-de11-9693-0003ffc4c746";
20 var recordid = "9721c859-d185-dc11-ac34-000c291d8da3";
21 var target = "TargetOwnedAccount";
22
23 var xml = "" +
24 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
25 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
26 header +
27 " <soap:Body>" +
28 " <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
29 " <Request xsi:type=\"AssignRequest\">" +
30 " <Target xsi:type=\""+ target +"\">" +
31 " <EntityId>"+ recordid +"</EntityId>" +
32 " </Target>" +
33 " <Assignee>" +
34 " <PrincipalId xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">"+ userid +"</PrincipalId>" +
35 " <Type xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">User</Type>" +
36 " </Assignee>" +
37 " </Request>" +
38 " </Execute>" +
39 " </soap:Body>" +
40 "</soap:Envelope>" +
41 "";
42
43 var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
44
45 xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
46 xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
47 xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
48 xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
49 xmlHttpRequest.send(xml);
50
51 var resultXml = xmlHttpRequest.responseXML;