// Bu sayfa sayesinde sistemde bize ait account'ları görüntüleyeceğiz // Aşağıdaki url'yi sisteminizdeki ile değiştirmeyi unutmayın var serverUrl = "http://danubecrm:5555/mscrmservices/2006"; // 'Microsoft.XMLHTTP' active object nesnesi MS CRM ile iletişimimizi sağlıyor 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>account</q1:EntityName>' + ' <q1:ColumnSet xsi:type="q1:ColumnSet">' + ' <q1:Attributes>' + ' <q1:Attribute>accountid</q1:Attribute>' + ' <q1:Attribute>name</q1:Attribute>' + ' </q1:Attributes>' + ' </q1:ColumnSet>' + ' <q1:Distinct>false</q1:Distinct>' + ' </query>'+ ' </soap:Body>'+ ' </soap:Envelope>') // Bir sonraki adımda bize geri dönen XML formatını sayfamızda görüntelenecek formata uygun hale getiriyoruz var result = xmlhttp.responseXML.xml; var BEs= result.split("<BusinessEntities>"); var BE = BEs[1].split("<BusinessEntity"); for (i = 0; i < BE.length; i++) { firstname = BE[i].indexOf("<name>")+6; secondname = BE[i].indexOf("</name>"); firstid = BE[i].indexOf("<accountid>")+11; secondid = BE[i].indexOf("</accountid>"); if (BE[i].substring(firstid,secondid).length > 0 ) { // The URL below must also be changed to the users MSACRM server URL document.writeln("<a href=\"http://danubecrm:5555/sfa/accts/edit.aspx?id=" + BE[i].substring(firstid,secondid) + "\" target=\"new\"><font size=\"2px\"" + "name=\"verdana\">" + BE[i].substring(firstname,secondname) + "</font></a><BR>"); } } //En sonunda da sayfamızda bunu çağırmaya sıra geldi <body bgcolor="#eff3f7"> <script language="JavaScript" type="text/javascript"> AccessCRMWebServices() ; </script> </body> |