简体   繁体   English

CRM 2011自定义工作流程持续处于“等待”状态

[英]CRM 2011 Custom Workflow Continually in 'Waiting' Status

I am working on a Custom Workflow within CRM 2011. I have created the workflow to create a couple of records (invoice and invoice product) once I get a particular type of Activity (a custom activity). 我正在CRM 2011中进行自定义工作流。我创建了工作流,以在获得特定类型的活动(自定义活动)后创建几个记录(发票和发票产品)。 During the testing I passed the particular GUID of the entity I would be working with (the creation of said entity would be the trigger for the workflow). 在测试期间,我通过了将要使用的实体的特定GUID(创建所述实体将触发工作流)。 The workflow works fine when I pass in a GUID for the record I want to work with. 当我为要使用的记录传递GUID时,工作流工作正常。 However, once I load the dll File inside CRM and attempt to trigger the workflow it goes into a waiting status and stays there. 但是,一旦我将DLL文件加载到CRM中并尝试触发工作流,它将进入等待状态并停留在那里。 I have try catch blocks on all of my functions with a throw new InvalidPluginExecutionException("Error occurred in MethodName:" + ex.Message); 我尝试在我的所有函数上使用throw new InvalidPluginExecutionException("Error occurred in MethodName:" + ex.Message); catch块throw new InvalidPluginExecutionException("Error occurred in MethodName:" + ex.Message); . It does not fail or stop but just continues in a waiting status. 它不会失败或停止,而只会继续处于等待状态。

I have tried to Reset : 我试图重置:

  • IIS IIS
  • async service 异步服务
  • Sync Services (Have Tried Edit: 同步服务(已尝试编辑:
  • Adding Version Control 添加版本控制
  • Uninstall / Reinstall assembly) 卸载/重新安装程序集)

Currently I am attempting to pull the activity id of the PrimaryEntityId as my primary entity is the record I need to use for the workflow. 目前,我正在尝试提取PrimaryEntityId的活动ID,因为我的主要实体是我需要用于工作流的记录。 The only thing that I need from that record is the ID. 该记录中我唯一需要的就是ID。

public String GetFeeId(WorkFlowHelper workFlowHelper, CodeActivityContext executionContext)
    {
        String feeRecordId = string.Empty;
        try
        {
            var primaryEntity = workFlowHelper.workFlowContext.PrimaryEntityId;
            if (primaryEntity != null)
            {
                feeRecordId = workFlowHelper.workFlowContext.PrimaryEntityId.ToString();
            }
            if (primaryEntity == null)
            {
                workFlowHelper.WorkFlowError("Primary Entity is null");
            }
        }
        catch (Exception ex)
        {
            if (workFlowHelper.debugMessagesOn == true)
            {
                Console.WriteLine("Id is blank!");
            }
            workFlowHelper.WorkFlowError(ex.ToString());
            throw new InvalidPluginExecutionException("Error occured in ConnectionInfo Method:" + ex.Message);
        }
        return feeRecordId;

Any ideas on what could be causing this? 关于什么可能导致此的任何想法?

Thanks, 谢谢,

It sounds like CRM may be having a problem loading your assembly, or confusing it for an older version of the same assembly. 听起来CRM可能在加载程序集时遇到问题,或者使它对于同一程序集的旧版本感到困惑。

Are you versioning your workflow assembly while you develop and deploy it, and is the assembly signed with a strong-name key? 您在开发和部署工作流程序集时是否对它进行版本控制,并且该程序集是否使用强名称密钥签名?

In Visual Studio on the Project tab, make sure you increment the Build/Revision number. 在Visual Studio的“项目”选项卡上,确保增加“生成/修订”编号。 See this article: http://gonzaloruizcrm.blogspot.com/2011/08/assembly-versioning-in-crm-2011.html 看到这篇文章: http : //gonzaloruizcrm.blogspot.com/2011/08/assembly-versioning-in-crm-2011.html

If you don't increment the Build/Revision, CRM may not see your updated assembly as an "update" and may be trying to use an older, cached version, which can cause all kinds of problems. 如果不增加“构建/修订”,则CRM可能不会将已更新的程序集视为“更新”,并且可能会尝试使用较旧的缓存版本,这可能会引起各种问题。

You may also try unregistering the assembly completely and then registering your latest version. 您也可以尝试完全取消注册程序集,然后注册最新版本。 You might need to update your workflows as well. 您可能还需要更新工作流程。

Here's the most simplest way (taken out your WorkFlowHelper).. 这是最简单的方法(取出您的WorkFlowHelper)。

public String GetFeeId(CodeActivityContext executionContext)
{
    // Create the context
    var context = executionContext.GetExtension<IWorkflowContext>();
    var feeRecordId = context.PrimaryEntityId
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM