且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MS CRM中的自定义工作流与插件

更新时间:2023-11-17 18:13:16

我自己深入研究了这个主题,发现了一些我想分享的有趣的东西, 所以这是compare的完整列表:

I went deep into the subject myself and found interesting things i want to share, So here is the complete list of compare :

  • 插件只能触发数据更改(如更新或创建记录),但是自定义工作流程会参与流程(工作流程,对话框等)中

  • Plug-in's only fire on data change like updating or creating records but custom workflows take part inside a process ( workflow, dialog, ... )

因此,工作流不仅可以在数据更改时触发,而且可以在过程中的任何时候随时随地触发.您可能已经了解到,这是实现复杂的业务逻辑所需的真正的灵活性.

As a result , workflows not only can be triggered on data change, but on demand at anytime at any point inside their process. As you might have already understood, It is the real flexibility needed for implementing complicated business logic.

插件将不接受参数或传递的数据, 但是自定义工作流程可以通过使用如下所示的InArgument属性来实现:

Plug-ins won't accept arguments or passed-data, But custom workflows make it possible by using InArgument properties like below :

[Input("Case")]     //label of the field shown in workflow
[ReferenceTarget("incident")]     //if using EntityReference, must point the type
public InArgument<EntityReference> yourArg { get; set; } //almost every data type is supported

  • 工作流可以由业务用户简单地使用和操纵.

  • Workflows can be simply used and manipulated by business users.

    自定义工作流是绝对可重用的.有了一个寄存器,您就有了可以在几种情况下使用的业务逻辑. 在某些情况下,您甚至可能碰巧编写了可在许多不同实体上使用的代码.

    Custom Workflows are absolutely reusable. with one register you have a piece of business logic that can be used in several situations. in some cases you might even happen to write a code which can be used upon many different entities.

    到目前为止,您知道自定义工作流程比插件更可靠,但是让插件接管自定义工作流程的要点是当您验证数据更改并最终需要还原这些更改时.当然,这在自定义工作流程"中是可行的,但是添加插件比工作流程要容易得多.

    So far you know that custom workflow is more reliable than plug-in , but the point that makes a plugin's take over custom workflow is when you are validating data changes and eventually need to revert those changes . of course this is possible in Custom Workflows but it's much more easier to add a plugin than workflow.

    ,请记住,插件运行速度更快! (我自己测试过)

    and bare in mind that plugins run faster! (as i tested it myself)