Hi all,
I want to call plugin using custom ribbon button in Dynamic CRM online(Dynamic 365).
I have go though several link but still i am getting error.
My Code is
function CallActionFromJavaScript() {
debugger;
var entityId = Xrm.Page.data.entity.getId();
var entityName = "new_customsendactivity";
var requestName = "new_ActionCall";
var xml = "" +
"<s:Envelope xmlns:s=\"schemas.xmlsoap.org/.../envelope\"><s:Body><Execute xmlns=\"schemas.microsoft.com/.../Services\" xmlns:i=\"www.w3.org/.../XMLSchema-instance\"><request xmlns:a=\"schemas.microsoft.com/.../Contracts\"><a:Parameters xmlns:b=\"schemas.datacontract.org/.../System.Collections.Generic\"><a:KeyValuePairOfstringanyType><b:key>Target</b:key><b:value i:type=\"a:EntityReference\"><a:Id>"+entityId+"</a:Id><a:LogicalName>"+entityName+"</a:LogicalName><a:Name i:nil=\"true\"/></b:value></a:KeyValuePairOfstringanyType></a:Parameters><a:RequestId i:nil=\"true\"/><a:RequestName>"+requestName+"</a:RequestName></request></Execute></s:Body></s:Envelope>" +
"";
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("POST", "cenacis.crm8.dynamics.com/.../web", true);
xmlHttpRequest.setRequestHeader("SOAPAction","schemas.microsoft.com/.../Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
//xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseText;
alert(resultXml);
}
Below is my Plugin steps
And below is the plugin Code
I am getting the below error when call from button
Please suggest, how to resolve this issue.
*This post is locked for comments
Thanks all for sharing links and views.
I have solved my problem. Issue is inside the code, in the line
"Entity entity = (Entity)context.InputParameters["Target"]; "
As in .js file i have taken EntityRefrence as target and in the code i have written "Entity as Target"
After changing
Entity entity = (Entity)context.InputParameters["Target"];
to
EntityReference refrence = (EntityReference)context.InputParameters["Target"];
it works.
:)
Hi John,
Please refer the below URL
debajmecrm.com/.../invoke-your-custom-action-from-dynamics-crm-web-apidynamics-crm-2016
below is the screenshot of response header
and below is the response
"
<s:Envelope xmlns:s="schemas.xmlsoap.org/.../envelope"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">Process action associated with this process is not activated.</faultstring><detail><OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance"><ActivityId>f96bb96e-415d-46b9-85d9-5db26eb71c50</ActivityId><ErrorCode>-2147220891</ErrorCode><ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"><KeyValuePairOfstringanyType><a:key>OperationStatus</a:key><a:value i:type="b:int" xmlns:b="www.w3.org/.../XMLSchema">0</a:value></KeyValuePairOfstringanyType><KeyValuePairOfstringanyType><a:key>SubErrorCode</a:key><a:value i:type="b:int" xmlns:b="www.w3.org/.../XMLSchema">-2146233088</a:value></KeyValuePairOfstringanyType></ErrorDetails><Message>Process action associated with this process is not activated.</Message><Timestamp>2017-02-23T10:37:28.454577Z</Timestamp><ExceptionSource>PluginExecution</ExceptionSource><InnerFault i:nil="true"/><OriginalException>Microsoft.Xrm.Sdk.InvalidPluginExecutionException
at ActionCall.ActionCallclass.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.<>c__DisplayClass7.<Execute>b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxWorker.Execute(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, SandboxRequestCounter& workerCounter, Boolean returnTraceInfo)</OriginalException><TraceText>
[ActionCall: ActionCall.ActionCallclass]
[401b701a-a0f2-e611-810c-c4346bdd8041: ActionCall.ActionCallclass: Create of account]

</TraceText></OrganizationServiceFault></detail></s:Fault></s:Body></s:Envelope>
"
Hi John Cather ,
Assuming the following:
1. You do not want to use any of the workarounds suggested by Rich Pearson / Scott Durow (MVP)
2. You have made the message name changes in the Plugin and the JScript code, can you do the following?
Using the 'Network' tab under the Developer Tools on the browser, can you post a screenshot of the 'Response Headers'?
I think you are missing some code in Plugin.Refer this:
nishantrana.me/.../using-action-to-trigger-plugin-in-crm-20132015
Scott Durow
I am getting error while calling the action, please see my question on top.
I have share the details
An Action is essentially an on demand sync Workflow - both can trigger plugins or call custom workflow activities.
@Scott Drow,
i want to call plugin from Action on button click not workflow
If you create a realtime workflow - you can call the action from the workflow - then use the Ribbon Workbench Smart buttons to call that workflow.
See - www.develop1.net/.../Smart-Buttons-in-the-Ribbon-Workbench.aspx
Is your action Active on your CRM organisation. Try to activate and then try again.
Please try to call your action directly using a plugin first. This will help in eliminating if the issue is in action and plugin or xml call. Refer this:
https://mahenderpal.wordpress.com/2015/07/08/using-actions-in-microsoft-dynamics-crm-2015/
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156