使用工作流更新子记录

Ever wish you could use a workflow to update related/child records? For example, when I update the address on an account, update the address on all of the related contacts.
You can, with the help of the very helpful CRM 2011 Distribute Workflow Activity assembly written by Alberto Gemin on Codeplex.

我应该都很希望使用工作流来更新主记录的子记录,比方:Address 和 Contract 是1对多关系。那么怎么才干实现更新Address 的时候也批量更新Contract记录呢?尽管系统并没有为我们提供这种原生支持。可是我们任然能够使用第三方的开源工具来实现这个有意思的需求。

While this says “CRM 2011″ in the name, it works fine on CRM 2013 and CRM 2013 SP1.

这个工具从4.0開始就存在了,而且如今以及支持最新版本号的Dynamics CRM 2013了。以下是使用该工具的步骤:

  1. Import the solution from Codeplex
    导入下载下来的解决方式

  2. Create your child entity workflow(s). In this example, create a workflow for the contrat entity, check the box to run as a child workflow, uncheck the box to run on create of a record, and add your desired step.
    创建一个子类型的工作流。在这个样例里面,我们须要创建一个更新contract实体的字工作流,并把它的在记录创建时执行这个复选框取消。并加上些自己期望的工作流步骤。

  3. Create the master workflow that will trigger the child workflow. In this example it would be a workflow that runs on update of the address fields.
    创建一个父工作流,该工作流用来调用刚创建的子工作流,在这个样例里面。它是作用在Address实体上的工作流。

  4. Add a step. If you have successfully deployed the solution, you should see a new step called “DWF AG Utilities:Distribute One to Many.”
    假设我们部署成功。你应该能在工作流设计界面的步骤选择菜单中找到“DWF AG Utilities: Distribute One to Many
    ”这种步骤。

  1. In the step properties you need to specify two values: the database name of the 1:N relationship and the child workflow you created in step 2.
    为"DWF AG Utilities: Distribute One to Many”步骤指定对应的值:刚创建的子工作流,父实体和子实体直接的关系名称。

  2. Publish the workflow.
    公布工作里

Now, every time the master workflow is executed, it will run the child workflow on each related record. This works with both background (asynchronous) and real-time (synchronous) workflow processes.
这样我们就能够借助这个第三方的工作流来更新系统啦,它分别支持同步和异步类型的工作流。




原文地址:https://www.cnblogs.com/brucemengbm/p/7100767.html