Hallo zusammen,
in einigen Formularen zähle ich die über eine Funktion die Anzahl von Notizen und ergänze dann die Bezeichnung des entsprechenden Reiters um den ermittelten Wert. Das funktioniert soweit auch ganz gut. Ich habe aber den Nebeneffekt, dass der letzte Reiter aus diesem Formular verschwindet.
Kann mir jemand erkären, was ich falsch gemacht habe ;-(?
Hier mein Code:
crmForm.SetAnnotationCount = function(tabId)
{
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>annotation</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes><q1:Attribute>objectid</q1:Attribute></q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>objectid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values><q1:Value xmlns:q2=\"http://microsoft.com/wsdl/types/\" xsi:type=\"q2:guid\">" + crmForm.ObjectId + "</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;
var ValueList = resultXml.selectNodes("//BusinessEntity/q1:objectid");
//alert(ValueList.length);
var _NotizReiterElement = document.getElementById(tabId)
if (ValueList.length != 0)
{
_NotizReiterElement.innerHTML = "Notizen <b>("+ ValueList.length +")</b>";
}
}
crmForm.SetAnnotationCount("tab1Tab");
Schöne Grüße aus Bayern
Heiko Heinrich-Nestler
XING: http://www.xing.com/profile/Heiko_HeinrichNestler