Answered by:
Problem with case entity

Question
-
Hi,
I'm have the following function to retrive the case title from the regarding field in the E-Mail form.
Somehow it gives me the message:
"The entity with a name = 'case' was not found in the MetadataCache.
if(crmForm.all.regardingobjectid.DataValue!=null ) { var regardingobjectid = crmForm.all.regardingobjectid.DataValue[0].id; var authenticationHeader = GenerateAuthenticationHeader(); // Prepare the SOAP message. 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'>"+ authenticationHeader+ "<soap:Body>"+ "<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<entityName>case</entityName>"+ "<id>"+regardingobjectid+"</id>"+ "<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"+ "<q1:Attributes>"+ "<q1:Attribute>ticketnumber</q1:Attribute>"+ "<q1:Attribute>title</q1:Attribute>"+ "</q1:Attributes>"+ "</columnSet>"+ "</Retrieve>"+ "</soap:Body>"+ "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml); // Capture the result. var resultXml = xHReq.responseXML; // Check for errors. var errorCount = resultXml.selectNodes('//error').length; if (errorCount != 0) { var msg = resultXml.selectSingleNode('//description').nodeTypedValue; alert(msg); } else { alert(resultXml.selectSingleNode("//q1:title").nodeTypedValue); } }
Tuesday, December 1, 2009 4:06 PM
Answers
-
Try name: 'incident' not 'case'
My Dynamics CRM Blog: http://bovoweb.blogspot.com- Proposed as answer by Andrii ButenkoMVP, Moderator Tuesday, December 1, 2009 5:06 PM
- Marked as answer by Peter Bergman Wednesday, December 2, 2009 10:48 AM
Tuesday, December 1, 2009 4:47 PM
All replies
-
Try name: 'incident' not 'case'
My Dynamics CRM Blog: http://bovoweb.blogspot.com- Proposed as answer by Andrii ButenkoMVP, Moderator Tuesday, December 1, 2009 5:06 PM
- Marked as answer by Peter Bergman Wednesday, December 2, 2009 10:48 AM
Tuesday, December 1, 2009 4:47 PM -
Hmmm: Too bad c# dosen't have XML litterals
Ace of TradesTuesday, December 1, 2009 5:08 PM -
Thanks! Changing from case to incident worked.Wednesday, December 2, 2009 10:49 AM