Answered by:
setstateleadrequest soap

Question
-
hi,
i need to set lead to Disqualified from javascript (by soap)
can someone send me working example of this?Monday, June 1, 2009 8:52 AM
Answers
-
Hi.
Something like:
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>"+ "<Execute xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<Request xsi:type='SetStateLeadRequest'>"+ "<EntityId>"+leadid+"</EntityId>"+ "<LeadState>Disqualified</LeadState>"+ "<LeadStatus>-1</LeadStatus>"+ "</Request>"+ "</Execute>"+ "</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/Execute"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml);
Truth is opened the prepared mind My blog - http://a33ik.blogspot.com- Proposed as answer by Nishant RanaMVP Monday, June 1, 2009 9:15 AM
- Marked as answer by Marco Amoedo MVPModerator Monday, June 1, 2009 11:26 AM
Monday, June 1, 2009 9:12 AMModerator -
For future reference I suggest you download stunnware’s “.Net to javascript convertion tool”. It will help you create these types of queries in minutes. http://www.stunnware.com/crm2/topic.aspx?id=jswebservice2
Blog: http://mscrm4ever.blogspot.com/ * Website: http://gicrm.upsite.co.il/- Proposed as answer by Nishant RanaMVP Monday, June 1, 2009 9:32 AM
- Marked as answer by guymalka Monday, June 1, 2009 11:26 AM
Monday, June 1, 2009 9:32 AM
All replies
-
Hi.
Something like:
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>"+ "<Execute xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+ "<Request xsi:type='SetStateLeadRequest'>"+ "<EntityId>"+leadid+"</EntityId>"+ "<LeadState>Disqualified</LeadState>"+ "<LeadStatus>-1</LeadStatus>"+ "</Request>"+ "</Execute>"+ "</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/Execute"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", xml.length); xHReq.send(xml);
Truth is opened the prepared mind My blog - http://a33ik.blogspot.com- Proposed as answer by Nishant RanaMVP Monday, June 1, 2009 9:15 AM
- Marked as answer by Marco Amoedo MVPModerator Monday, June 1, 2009 11:26 AM
Monday, June 1, 2009 9:12 AMModerator -
For future reference I suggest you download stunnware’s “.Net to javascript convertion tool”. It will help you create these types of queries in minutes. http://www.stunnware.com/crm2/topic.aspx?id=jswebservice2
Blog: http://mscrm4ever.blogspot.com/ * Website: http://gicrm.upsite.co.il/- Proposed as answer by Nishant RanaMVP Monday, June 1, 2009 9:32 AM
- Marked as answer by guymalka Monday, June 1, 2009 11:26 AM
Monday, June 1, 2009 9:32 AM -
tried it
receive unexpected error
80040216Monday, June 1, 2009 1:02 PM -
Hi.
Could you paste your code here for investigation?
Truth is opened the prepared mind My blog - http://a33ik.blogspot.comMonday, June 1, 2009 1:09 PMModerator