10. Juni 2010 15:09
10. Juni 2010 19:18
11. Juni 2010 08:50
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<head>
<title>Unbenannte Seite</title>
</head>
<body>
<script type="text/javascript">
/* Client-side access to querystring name=value pairs
Version 1.3
28 May 2008
License (Simplified BSD):
http://adamv.com/dev/javascript/qslicense.txt
*/
function Querystring(qs) { // optionally pass a querystring to parse
this.params = {};
if (qs == null) qs = location.search.substring(1, location.search.length);
if (qs.length == 0) return;
// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
qs = qs.replace(/\+/g, ' ');
var args = qs.split('&'); // parse out name/value pairs separated via &
// split out each name=value pair
for (var i = 0; i < args.length; i++) {
var pair = args[i].split('=');
var name = decodeURIComponent(pair[0]);
var value = (pair.length==2)
? decodeURIComponent(pair[1])
: name;
this.params[name] = value;
}
}
Querystring.prototype.get = function(key, default_) {
var value = this.params[key];
return (value != null) ? value : default_;
}
Querystring.prototype.contains = function(key) {
var value = this.params[key];
return (value != null);
}
var qs1 = new Querystring();
var myKDNR = 0;
if (qs1.contains('kdnr'))
{
myKDNR = qs1.get('kdnr');
}
var qs2 = new Querystring();
var myAUFNR = 0;
if (qs2.contains('aufnr'))
{
myAUFNR = qs2.get('aufnr');
}
var qs3 = new Querystring();
var myANGNR = 0;
if (qs3.contains('angnr'))
{
myANGNR = qs3.get('angnr');
}
var qs4 = new Querystring();
var myTYP = 0;
if (qs4.contains('id'))
{
myTYP = qs4.get('id');
}
var myAKTIVITY = 0;
if (myTYP == 'Aufgabe')
{
myAKTIVITY = 'task'
}
if (myTYP == 'Fax')
{
myAKTIVITY = 'fax'
}
if (myTYP == 'Telefon')
{
myAKTIVITY = 'phone'
}
if (myTYP == 'Email')
{
myAKTIVITY = 'email'
}
if (myTYP == 'Brief')
{
myAKTIVITY = 'letter'
}
if (myTYP == 'Termin')
{
myAKTIVITY = 'appointment'
}
//KUNDEN GUID herausfinden
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\">" +
"<soap:Header>" +
"<CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"<AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"0" +
"</AuthenticationType>" +
"<OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"tw-elektric" +
"</OrganizationName>" +
"<CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"00000000-0000-0000-0000-000000000000" +
"</CallerId>" +
"</CrmAuthenticationToken>" +
"</soap:Header>" +
" <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>accountid</q1:Attribute>" +
" <q1:Attribute>name</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountnumber</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + myKDNR + "</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", "http://srv04:5555/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)
{
var resultXml = xmlHttpRequest.responseXML;
var nodeNumber = resultXml.selectNodes("//q1:accountid");
if (nodeNumber.length == 1)
{
var myAccountID = nodeNumber[0].text;
//alert(myAccountID);
}
var nodeNumber = resultXml.selectNodes("//q1:name");
if (nodeNumber.length == 1)
{
var myAccountName = nodeNumber[0].text;
myAccountName = myAccountName.replace(/\&/g,"_");
//alert(myAccountName);
}
}
if (myAUFNR.length != 0)
{
//AUFTRAG GUID herausfinden
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\">" +
"<soap:Header>" +
"<CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"<AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"0" +
"</AuthenticationType>" +
"<OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"tw-elektric" +
"</OrganizationName>" +
"<CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"00000000-0000-0000-0000-000000000000" +
"</CallerId>" +
"</CrmAuthenticationToken>" +
"</soap:Header>" +
" <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>new_order</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>new_orderid</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>new_auftragnummer</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + myAUFNR + "</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", "http://srv04:5555/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)
{
var resultXml = xmlHttpRequest.responseXML;
var nodeNumber = resultXml.selectNodes("//q1:new_orderid");
if (nodeNumber.length == 1)
{
var myOrderID = nodeNumber[0].text;
//alert(myOrderID);
var URL = "http://srv04:5555/tw-elektric/activities/" + myAKTIVITY + "/edit.aspx?partyid=" + myAccountID +
"&partyType=1&partyName=" + myAccountName +
"&pId=" + myOrderID + "&pType=10002&pName=" + myAUFNR;
document.location.href = URL;
//window.open(URL);
}
}
}
if (myANGNR.length != 0)
{
//ANGEBOT GUID herausfinden
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\">" +
"<soap:Header>" +
"<CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"<AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"0" +
"</AuthenticationType>" +
"<OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"tw-elektric" +
"</OrganizationName>" +
"<CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" +
"00000000-0000-0000-0000-000000000000" +
"</CallerId>" +
"</CrmAuthenticationToken>" +
"</soap:Header>" +
" <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>new_offer</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>new_offerid</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>new_angebotnummer</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + myANGNR + "</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", "http://srv04:5555/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)
{
var resultXml = xmlHttpRequest.responseXML;
var nodeNumber = resultXml.selectNodes("//q1:new_offerid");
if (nodeNumber.length == 1)
{
var myOfferID = nodeNumber[0].text;
//alert(myOfferID);
var URL = "http://srv04:5555/tw-elektric/activities/" + myAKTIVITY + "/edit.aspx?partyid=" + myAccountID +
"&partyType=1&partyName=" + myAccountName +
"&pId=" + myOfferID + "&pType=10001&pName=" + myANGNR;
document.location.href = URL;
//window.open(URL);
}
}
}
</script>
</body>
</html>
11. Juni 2010 13:43
24. Juni 2010 16:13
30. Juni 2010 10:42
30. Juni 2010 16:53
tw-elektric hat geschrieben:Ich habe es mit &subject=Testausfgabe (so heißt das feld in der db und so wird es im html als ID verwendet) versucht, es kommt kein Fehler, aber ich bekomme auch nichts angezeigt.
2. Juli 2010 10:45
if (crmForm.FormType == 1) {
var strSub;
strSub = getQueryValue('subject');
if (strSub != null)
{
crmForm.all.subject.DataValue = strSub;
}
}
function getQueryValue(strField)
{
var strQuery = window.location.search.substring(1);
var arrFields = strQuery.split("&");
for (var i=0; i<arrFields.length; i++)
{
var arrPair = arrFields[i].split("=");
if (arrPair[0] == strField)
{
return arrPair[1];
}
}
}
2. Juli 2010 11:49
9. September 2011 15:39
14. September 2011 11:09
Note This technique currently works for all entities except Activity entities.
14. September 2011 19:43