插件注册中未显示自定义工作流活动

时间:2015-04-16 09:40:37

标签: c# dynamics-crm workflow-foundation-4 workflow-foundation dynamics-crm-online

有人可以在这里暗示我做错了吗?

我使用此示例Create a custom workflow activity创建了自定义工作流活动。但这并没有在插件注册工具中显示为插件/活动类型。见下图:

enter image description here

以下活动的示例代码:

CODE UPDATED

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace TestCustomWorkflowActivity
{
    public class SampleCustomActivity : CodeActivity
    {
        protected override void Execute(CodeActivityContext executionContext)
        {
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();

            //Create the context
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

        }
    }
}

平台
Dynamics CRM 2013 On Premises v 6.1.2.112(已安装SP1 UR2)
Dynamics CRM 2015 Online

.NET Framework版本
4.0

2 个答案:

答案 0 :(得分:7)

在使用CRM 2013(内部部署和在线)时,我遇到了完全相同的问题。我从未设法真正解决问题,但通过使用2015年的SDK注册工具轻松解决了这个问题。出于不明原因,一个人工作得更好。

答案 1 :(得分:6)

您的控股课是否需要公开?

class TestWfActivity

应该是

public class TestWfActivity

或者Activity类应直接驻留在您的namepspace中,而不是使用TestWFActivity类。

尝试 -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace TestCustomWorkflowActivity
{
    public class TestWfActivity
    {
        public class SampleCustomActivity : CodeActivity 
        {
            protected override void Execute(CodeActivityContext executionContext)
            {
                //Create the tracing service
                ITracingService tracingService = executionContext.GetExtension<ITracingService>();

                //Create the context
                IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
                IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace TestCustomWorkflowActivity
{

        public class SampleCustomActivity : CodeActivity 
        {
            protected override void Execute(CodeActivityContext executionContext)
            {
                //Create the tracing service
                ITracingService tracingService = executionContext.GetExtension<ITracingService>();

                //Create the context
                IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
                IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            }
        }
}