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
{
public class Audit :
CodeActivity
{
protected override void 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.
*This post is locked for comments
I have the same question (0)Hi, We were able to fix the problem.
We registred the assembbly in Sandbox mode, so while adding custom activity to the workflow it is giving error. Instead regsiter the assembly in 'None' mode. Please note that you should have 'Deployment Manager' access to register in 'None' mode.
If you are using VS solution to register the assembly, you cant deploy a workflow in 'None' mode, instead use plugin registration tool.
Hope this helps.
Aric Levin - MVP
2
Moderator
MA-04060624-0
1