如何实现并行审批流程中的拒绝?
我开发了一个带有复制器活动的 SharePoint 工作流,以便为每个审批者复制自定义活动。 自定义活动为特定用户实现审批分支。 它具有 CreateTask、While、OnTaskChanged 和 CompleteTask 活动的经典形式。
我在复制器上设置 UntilCondition,以便在一位审批者选择拒绝审批后取消执行,然后工作流程完成。 该问题发生在其他未完成的任务上,这些任务在当前状态下“挂起”。 用户打开任务时看不到此状态。
我将 UpdateAllTasks 放在替换器之后,以将任务状态设置为“已取消”。 但由于 CompleteTask(对于被拒绝的任务)和 UpdateAllTasks 之间没有事件活动,因此对于被拒绝的任务,UpdateAllTask 活动也设置为 Canceled。
问题是,我该怎么做才能在 UpdateAllTasks 之前刷新 CompleteTask 所做的挂起更改?
或者,也许还有另一种方法来实现这样的工作流程。 我正在考虑如何使用 UpdateTask 为自定义活动实现取消处理程序。 但我不知道如何实现它并告诉取消处理程序它在拒绝的情况下执行。
I develop a SharePoint workflow with a Replicator activity to replicate a custom activity for every approver. The custom activity implements an approval branch for a particular user. It has classic form with CreateTask, While, OnTaskChanged and CompleteTask activities.
I setup UntilCondition on the replicator to cancel execution after one approver chooses to reject the approval and then workflow finishes. The problem happens with other uncompleted tasks which "hang" in their current state. User does not see this state when open the task.
I put UpdateAllTasks after the replacator to set the task status to Cancelled. But since there is no event activities between CompleteTask (for the rejected task) and UpdateAllTasks, the UpdateAllTask activity set Cancelled for the rejected task also.
The question, what can I do to flush the pending change made by CompleteTask before UpdateAllTasks?
Or perhaps, there is another way to implement such workflow. I was thinking about the way to implement Cancel handler for the custom activity with UpdateTask. But I do not know how to implement it and tell to the cancel handler that it executes in the case of the rejection.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在面临同样的问题并花费大量时间研究和尝试不同的选择之后,我认为我找到了一个非常好的解决方案。 我将其发布在这里供后代使用。
如果您对这种情况有任何经验,那么您已经准备好了告诉我 UpdateAllTasks 还会更新最初被拒绝的任务,因为“CompleteTask”尚未保存到数据库中。 神奇之处在于您可以为自定义活动 (ReviewActivity) 定义一个名为 PersistOnClose 的属性。
此属性可确保 ReviewActivity 完成后,所有更改都将保存到数据库中。 由于 ReviewActivity 中的最后一个活动是“CompleteTask”,因此该任务将保存到数据库中。 因此,UpdateAllTasks 不会触及它。
我希望这可以帮助别人。
After being faced with the same problem and spending a lot of time researching and trying out different options, I think I found a really good solution. I'm posting it here for posterity.
If you have any experience with this scenario at all, you are getting ready to tell me that UpdateAllTasks also updates the originally rejected task since the "CompleteTask" has not been persisted to the database yet. The magic is in an attribute that you can define for the custom activity (ReviewActivity) called PersistOnClose.
This attribute ensures that once the ReviewActivity is complete, all changes are persisted to the database. Since the last activity in the ReviewActivity is the "CompleteTask", the task is saved to the DB. Therefore, the UpdateAllTasks will not touch it.
I hope this helps someone.
您是否尝试在完成任务和 updatealltasks 活动之间放置代码活动?
Did you try putting a code activity between the complete task and updatealltasks activity?
按以下方式构建您的活动:
创建任务-> OnTaskChanged ->; If/Else 活动(如果批准者决策为“拒绝”,则将条件设置为 true)-> (在 If 分支内)UpdateAllTasks Activity(在 Activity 属性中将状态设置为取消)-> (在 If 分支之外)CompleteTask 活动。
当审批者决定拒绝某个任务时,WF 将取消所有任务。 它还将取消拒绝者的任务,但在“CompleteTask”活动将触发并将相应的任务设置为“已完成”之后。
Struct your activities as the following:
Create Task - > OnTaskChanged -> If/Else Activity (set the condition true if the approver decision was "reject") -> (Inside the If branch) UpdateAllTasks Activity (set the status to cancel within the Activity properties) -> (Outside the If branch) CompleteTask Activity.
When an approver decides to reject a task, the WF will cancel all the tasks. It will also cancel the task of the person who rejected but right after the "CompleteTask" activity will fire and set the corresponding task as Completed.
我今天遇到了类似的问题。 我解决了这个问题:
I was faced with a similar problem today. I solved it with: