Set statecode inactive RRS feed

  • Question


    Hello guys,


    we working with CRM 4 and have a problem using JScript by deactivate userdefine entities.

    I look up and find http://forums.microsoft.com/Dynamics/ShowPost.aspx?PostID=3586741&SiteID=27 but it doesn't help me.

    At this time, we tested somithing with Update-WebService, but it doesn't worked.


    Code Snippet
    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'>"+
       "<Update xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
       "<entity xsi:type='new_abc'>"+
       //Prepare the xmlHttpObject and send the request.
       var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
       xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
       xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
       xHReq.setRequestHeader("Content-Length", xml.length);




    There is no error displayed using statecode 0 or 1. If the statecode isn't 0 or 1 an error occured.


    Thank you!

    Monday, August 11, 2008 2:42 PM


All replies

  • Are you also setting a corresponding Statuscode? It doesn't look like it. Record states and status always occur together, meaning you have to set a valid statuscode for a statecode. If the two don't match, you'll get an error from the CRM API.

    Monday, August 11, 2008 4:59 PM
  • You need to use the SetState[Entity]Request Message, not Update.




    Monday, August 11, 2008 5:57 PM