【发布时间】:2016-10-24 21:27:30
【问题描述】:
我有一个自定义工作流活动,它接受一个名为“InputTest”的输入参数。这只是一个字符串。
[Input("InputTest")]
[RequiredArgument]
public InArgument<string> TargetEntity { get; set; }
在我的自定义工作流活动中,我想阅读它,所以我执行以下操作:
string targetEntityValue = TargetEntity.Get(executionContext);
添加该行后,我的工作流活动将不再执行。当我运行它时,状态将显示“Succeeded”,但工作流中的任何内容都不会运行,甚至工作流开始时的跟踪也不会显示工作流已进入。诊断日志中没有任何内容。当我运行 SQL Profiler 时,只有几条语句添加到 AsyncBase 表中,表明工作流已经运行并立即完成。
如果我删除上述行,则工作流程运行正常。我想知道我在这里做错了什么?为什么读取输入参数会导致 CRM 在工作流程中不执行任何操作?
这几乎就像代码没有进入它的主要方法一样。
[Input("Entity")]
[RequiredArgument]
public InArgument<string> TargetEntity { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
// Create the tracing service
ITracingService tracingService = executionContext.GetExtension<ITracingService>();
if (tracingService == null)
{
throw new InvalidPluginExecutionException("Failed to retrieve tracing service.");
}
tracingService.Trace("Entered TestWorkflow.Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}",
executionContext.ActivityInstanceId,
executionContext.WorkflowInstanceId);
string targetEntityValue = TargetEntity.Get<string>(executionContext);
}
【问题讨论】:
-
您使用的是什么 CRM 版本,以及什么 SDK 版本?
-
Dynamics CRM 2016 本地部署。
标签: c# dynamics-crm