locked
CRM 2013 SP1: Custom Action - New bug introduced RRS feed

  • Question

  • Hi,

    I was using following SOAP XML to invoke my custom action in CRM 2013. The custom action does not accept any input parameter. However, to invoke a custom action from JavaScript, you have to have a Target parameter passed in, else the action invocation used to fail.

    function ExecuteAction(actionName)
    {
    	// Creating the request XML for calling the Action
    		requestXML += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
    		requestXML += "  <s:Body>";
    		requestXML += "    <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
    		requestXML += "      <request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
    		requestXML += "        <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
    		requestXML += "          <a:KeyValuePairOfstringanyType>";
    		requestXML += "            <b:key>Target</b:key>";
    		requestXML += "            <b:value i:type=\"a:EntityReference\">";
    		requestXML += "              <a:Id>" + Xrm.Page.data.entity.getId() + "</a:Id>";
    		requestXML += "              <a:LogicalName>" + Xrm.Page.data.entity.getEntityName() + "</a:LogicalName>";
    		requestXML += "              <a:Name i:nil=\"true\" />";
    		requestXML += "            </b:value>";
    		requestXML += "          </a:KeyValuePairOfstringanyType>";
    		requestXML += "        </a:Parameters>";
    		requestXML += "        <a:RequestId i:nil=\"true\" />";
    		requestXML += "        <a:RequestName>" + actionName + "</a:RequestName>";
    		requestXML += "      </request>";
    		requestXML += "    </Execute>";
    		requestXML += "  </s:Body>";
    		requestXML += "</s:Envelope>";
    	
    
    	var req = new XMLHttpRequest();
    	req.open("POST", GetServiceUrl(), false)
    	req.setRequestHeader("Accept", "application/xml, text/xml, */*");
    	req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    	req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
    	req.send(requestXML);
    
    	//refresh the page if the request was successful.
    	if (req.status == 200)
    	{
    		if (refreshPage)
    		{
    			RefreshForm()
    		}
    	}
    	else
    	{
    		Xrm.Utility.alertDialog(req.statusText + "\n" + req.responseXML.getElementsByTagName("faultstring")[0].textContent);
    	}
    }

    Now with SP 1 installed, the same JavaScript throws "Internal Server Error Unrecognized request parameter: Target" error. Why further break what was already broken and throw everybody's workaround out of whack?


    • Edited by Ahmad Pirani Monday, August 11, 2014 10:15 PM forum does not accept images. Hence pasting the error message.
    Monday, August 11, 2014 9:54 PM