Note that there are some explanatory texts on larger screens.

plurals
  1. POCRM 2013: Calling actions from javascript
    primarykey
    data
    text
    <p>I was trying to call action from javascript using the below function:</p> <pre><code>function ExecuteActionCreateProject(reason, entityId, entityName, requestName) { // Creating the request XML for calling the Action var requestXML = "" requestXML += "&lt;s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;"; requestXML += " &lt;s:Body&gt;"; requestXML += " &lt;Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;"; requestXML += " &lt;request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"&gt;"; requestXML += " &lt;a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\"&gt;"; requestXML += " &lt;a:KeyValuePairOfstringanyType&gt;"; requestXML += " &lt;b:key&gt;Reason&lt;/b:key&gt;"; requestXML += " &lt;b:value i:type=\"c:string\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\"&gt;"+reason+"&lt;/b:value&gt;"; requestXML += " &lt;/a:KeyValuePairOfstringanyType&gt;"; requestXML += " &lt;a:KeyValuePairOfstringanyType&gt;"; requestXML += " &lt;b:key&gt;Target&lt;/b:key&gt;"; requestXML += " &lt;b:value i:type=\"a:EntityReference\"&gt;"; requestXML += " &lt;a:Id&gt;"+entityId+"&lt;/a:Id&gt;"; requestXML += " &lt;a:LogicalName&gt;"+entityName+"&lt;/a:LogicalName&gt;"; requestXML += " &lt;a:Name i:nil=\"true\" /&gt;"; requestXML += " &lt;/b:value&gt;"; requestXML += " &lt;/a:KeyValuePairOfstringanyType&gt;"; requestXML += " &lt;/a:Parameters&gt;"; requestXML += " &lt;a:RequestId i:nil=\"true\" /&gt;"; requestXML += " &lt;a:RequestName&gt;"+requestName+"&lt;/a:RequestName&gt;"; requestXML += " &lt;/request&gt;"; requestXML += " &lt;/Execute&gt;"; requestXML += " &lt;/s:Body&gt;"; requestXML += "&lt;/s:Envelope&gt;"; var req = new XMLHttpRequest(); req.open("POST", GetClientUrl(), 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/IOrganizationServic/Execute"); req.send(requestXML); //Get the Resonse from the CRM Execute method var response = req.responseXML.xml; } </code></pre> <p>I was able to pass function parameters and client URL successfully, however this is the response this I get:</p> <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;s:Body&gt; &lt;s:Fault&gt; &lt;faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none"&gt;a:ActionNotSupported&lt;/faultcode&gt; &lt;faultstring xml:lang="en-US"&gt;The message with Action 'http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationServic/Execute' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). &lt;/faultstring&gt; &lt;/s:Fault&gt; &lt;/s:Body&gt; &lt;/s:Envelope&gt; </code></pre> <p>Kindly advise</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload