REQUEST A DEMO

Too many angle brackets make my head hurt

 

Saw this code sample on the Microsoft Dynamics CRM blog, listed under Customizing CRM made easy:

 

 

var xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);

 

xmlhttp.open(“POST”, serverUrl + “/crmservice.asmx”, false);

 

xmlhttp.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8”) ;

 

xmlhttp.setRequestHeader(“SOAPAction”, “http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple”) ;

 

xmlhttp.send(“<?xml version=’1.0′ encoding=’utf-8′?>”+”\n\n”+”<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”>’+
‘ <soap:Body>’ +
‘ <query xmlns:q1=http://schemas.microsoft.com/crm/2006/Query’ +
‘ xsi:type=”q1:QueryExpression” xmlns=”http://schemas.microsoft.com/crm/2006/WebServices”>’+
‘ <q1:EntityName>pricelevel</q1:EntityName>’+
‘ <q1:ColumnSet xsi:type=”q1:ColumnSet”>’+
‘ <q1:Attributes>’+
‘ <q1:Attribute>pricelevelid</q1:Attribute>’+
‘ <q1:Attribute>name</q1:Attribute>’+
‘ </q1:Attributes>’+
‘ </q1:ColumnSet>’+
‘ <q1:Distinct>false</q1:Distinct>’+
‘ <q1:LinkEntities>’+
‘ <q1:LinkEntity>’+
‘ <q1:LinkFromAttributeName>pricelevelid</q1:LinkFromAttributeName>’+
‘ <q1:LinkFromEntityName>pricelevel</q1:LinkFromEntityName>’+
‘ <q1:LinkToEntityName>account</q1:LinkToEntityName>’+
‘ <q1:LinkToAttributeName>defaultpricelevelid</q1:LinkToAttributeName>’+
‘ <q1:JoinOperator>Inner</q1:JoinOperator>’+
‘ <q1:LinkCriteria>’+
‘ <q1:FilterOperator>And</q1:FilterOperator>’+
‘ <q1:Conditions>’+
‘ <q1:Condition>’+
‘ <q1:AttributeName>accountid</q1:AttributeName>’+
‘ <q1:Operator>Equal</q1:Operator>’+
‘ <q1:Values>’+
‘ <q1:Value xmlns:q2=”http://microsoft.com/wsdl/types/”‘+
‘ xsi:type=”q2:guid”>’ +
id +
‘ </q1:Value>’+
‘ </q1:Values>’+
‘</q1:Condition>’+
‘ </q1:Conditions>’+
‘</q1:LinkCriteria>’+
‘ </q1:LinkEntity>’+
‘ </q1:LinkEntities>’+
‘ </query>’+
‘ </soap:Body>’+
‘ </soap:Envelope>’) ;

 

var result = xmlhttp.responseXML.xml;

 

 

 

I don’t even like looking at that code, never mind thinking about having to maintain it.