Hi,
Below is my plain custom activity code.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Activities;
using
System.Threading.Tasks;
using
Microsoft.Xrm.Sdk;
using
Microsoft.Xrm.Sdk.Workflow;
namespace
ActivityLibrary1
{
publicclassAudit :
CodeActivity
{
protectedoverridevoid Execute(CodeActivityContext
context)
{
//Create the IWorkflowContext and the
//IOrganizationService for communication with CRM
IWorkflowContext
workflowContext =
context.GetExtension<
IWorkflowContext
>();
IOrganizationServiceFactory
serviceFactory =
context.GetExtension<
IOrganizationServiceFactory
>();
IOrganizationService
service =
serviceFactory.CreateOrganizationService(workflowContext.UserId);
//Retrieve data from InputParameter
}
}
}
I am able to register the assembly and plugin uisng plugin registration tool, but when i am trying to add the custom activity to a process/workflow i m getting the below error.
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Workflow contains an invalid custom activity.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147200968</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message></Message>
<Timestamp>2013-05-09T12:05:19.6794822Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
Any help appreciated? Thank you.