使用工作流更新子记录

 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.
这样我们就可以借助这个第三方的工作流来更新系统啦,它分别支持同步和异步类型的工作流。



你可能感兴趣的:(使用工作流更新子记录)