4. Februar 2010 10:42
4. Februar 2010 11:00
4. Februar 2010 11:17
4. Februar 2010 16:00
4. Februar 2010 16:40
5. Februar 2010 10:30
// Ermittelt die Firmennummer und Telephone1 der übergeordneten Firma im Kontakt
alert("test");
if (crmForm.all.new_parentcustomerid.DataValue != null)
{
var myAccountId = crmForm.all.new_parentcustomerid.DataValue[0].id;
// Define the SOAP XML to access Microsoft Dynamics CRM Web service.
var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<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\">" +
GenerateAuthenticationHeader()+
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>account</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>accountnumber</q1:Attribute>" +
" <q1:Attribute>telephone1</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">myAccountId</q1:Value>" +
" </q1:Values>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>";
// Create an instance of an XMLHTTP object.
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
// Configure the XMLHttp object for the
// Microsoft CRM Web services.
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
// Send the XMLHttp request.
xmlHttpRequest.send(xml);
if(xmlHttpRequest.status == 200)
{
// Capture the XMLHttp response in XML format.
var resultXml = xmlHttpRequest.responseXML;
var nodeNumber = resultXml.selectNodes("//q1:accountnumber");
if (nodeNumber.length == 1)
{
//crmForm.all.Field1.DataValue = parseFloat(nodeNumber[0].text);
alert(parseFloat(nodeNumber[0].text));
}
var nodeTelephone = resultXml.selectNodes("//q1:telephone1");
if (nodeTelephone.length == 1)
{
//crmForm.all.Field2.DataValue = parseFloat(nodeTelephone[0].text);
alert(parseFloat(parseFloat(nodeTelephone[0].text));
}
}
}
5. Februar 2010 16:42
8. Februar 2010 09:11
michael sulz hat geschrieben:Hallo,
OnSave ist falsch, du must es in das OnChange des Lookups mit deinem Vertreter packen, da sich ja der Wert ändern soll, wenn du einen anderen Vertreter auswählst.
8. Februar 2010 09:16
Leider bekomme ich beim gleichen Code, wie gepost, wieder unten in der Statusleiste "Fehler auf der Seite"
Ich verstehe nicht, warum nicht mal das Test-Alert aufpopt?
8. Februar 2010 11:18
if (crmForm.all.new_parentcustomerid.DataValue != null)
{
var myAccountId = crmForm.all.new_parentcustomerid.DataValue[0].id;
// Define the SOAP XML to access Microsoft Dynamics CRM Web service.
var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<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\">" +
GenerateAuthenticationHeader()+
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>account</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>accountnumber</q1:Attribute>" +
" <q1:Attribute>telephone1</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + myAccountId + "</q1:Value>" +
" </q1:Values>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>";
// Create an instance of an XMLHTTP object.
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
// Configure the XMLHttp object for the
// Microsoft CRM Web services.
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
// Send the XMLHttp request.
xmlHttpRequest.send(xml);
8. Februar 2010 11:42
Und der Request Status gibt statt 200, 500 aus.
500 Internal Server Error Der Server kann die angeforderten Daten nicht senden, weil auf dem Server ein Fehler aufgetreten ist. Beispielsweise konnte das aufgerufene CGI-Script nicht gestartet werden.
8. Februar 2010 11:58
8. Februar 2010 12:23
if (crmForm.all.new_parentcustomerid.DataValue != null)
{
var myAccountId = crmForm.all.new_parentcustomerid.DataValue[0].id;
var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<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\">" +
GenerateAuthenticationHeader()+
" <soap:Body>" +
" <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>account</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>new_parentagentid</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + myAccountId + "</q1:Value>" +
" </q1:Values>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
if(xmlHttpRequest.status == 200)
{
// Capture the XMLHttp response in XML format.
var resultXml = xmlHttpRequest.responseXML;
var nodeNumber = resultXml.selectNodes("//q1:new_parentagentid");
if (nodeNumber.length == 1)
{
alert(parseFloat(nodeNumber[0].text));
}
}
}
8. Februar 2010 12:28
crmForm.all.<name des Lookupsfeldes>.DataValue[0].id;
8. Februar 2010 12:38
8. Februar 2010 20:31