Sharepoint 工作流程 - 当另一个工作流程更改状态时,等待字段更改不会触发

发布于 2024-08-04 12:47:36 字数 502 浏览 11 评论 0原文

我正在尝试在 Sharepoint Designer 上创建工作流程。该工作流应等到开箱即用的批准工作流完成。这是通过从创建项目开始我的工作流程并使用 wait 活动来完成的:

等待当前项目中的字段更改:
等待 InternalApproval 等于 16

问题:规则是正确的,但除非对项目进行编辑,否则不会触发事件。通常,每次编辑都会触发工作流程检查,但我的测试显示批准工作流程不会在项目上触发此事件

有一个简单的方法可以解决这个问题吗?我想实现一个繁忙的等待,但是如何实现(有一个 wait 5 分钟 活动,但没有 goto)?是否有我可以下载的活动可以等待另一个工作流程完成,或者忙于等待直到满足条件?
解决我的问题的另一种方法是,如果InternalApproval工作流程更改了一个字段,但我也无法实现这一点......

I'm trying to create a workflow on the Sharepoint Designer. The workflow should wait until an Out-Of-The-Box approval workflow is complete. This is done by starting my workflow with the item's creation, and usign the wait activity:

Wait for field change in current item:
Wait for InternalApproval to equal 16

The problem: the rule is correct, but the event doesn't fire unless an edit is made on the item. Normally, every edit triggers the workflow check, but my tests show approving a workflow doesn't trigger this event on the item.

Is there an easy way around this issue? I though about implementing a busy wait, but how (there's a wait 5 minutes activity, but no goto)? Is there an activity I can download that can wait for another workflow to complete, or busy wait until a condition is met?
Another way to solve my problem is if the InternalApproval workflow changed a field, but I cannot achieve that either...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

╄→承喏 2024-08-11 12:47:36

这是预期的行为。否则,在项目更改时自动取消的审批工作流程将毫无用处。在 API 级别,SharePoint 禁止在需要更新其运行的项目时引发事件。

-奥辛

This is expected behaviour. An approval workflow that is wired to cancel itself upon changes to the item would otherwise be useless. At the API level, SharePoint is disabling events from being raised when it needs to update the item upon which it is running.

-Oisin

霞映澄塘 2024-08-11 12:47:36

我最终编写了一个自定义工作流程活动,该活动会等待进行更改,然后恢复工作流程。此活动可以通过两种方式使用 - 在主工作流程上,或在第二个工作流程上,它等待非触发更改,并进行触发更改(以便主工作流程恢复)。
编写它非常有趣 - 我使用 Reflector 从 OOTB 活动(正常的等待字段更改)复制一些代码,并复制其操作 xml。经过一番尝试后效果非常好,给出了字段、运算符和值的列表。

自定义 Sharepoint 工作流程活动 - 我正在写博客

检查条件是也很简单,使用 Helper 类。所有属性及其绑定都是使用 Reflector 复制的:

public void CheckStopCondition(object sender, ConditionalEventArgs e)
{
    bool checkAgainLater = Helper.TestListItem(Context, ListId, ListItem, 
                                               FieldName, Operator, Value);
    e.Result = checkAgainLater;
}

I ended up writing a custom workflow activity that waits until a change is made, and resumes the workflow. This activity can be used in two ways - on the main workflow, or on a second workflow, where it waits for a non-triggering change, and makes a triggering change (so the main workflow resumes).
Writing it was big fun - I used Reflector to copy some code from an OOTB activity (the normal Wait For Field Change), and copied its action xml. This works very well after some tries, giving a list of fields, operators and values.

Custom Sharepoint Workflow Activity - I'm blogging this

Checking the condition is also quite simple, using the Helper class. All properties and their binding were copied using Reflector:

public void CheckStopCondition(object sender, ConditionalEventArgs e)
{
    bool checkAgainLater = Helper.TestListItem(Context, ListId, ListItem, 
                                               FieldName, Operator, Value);
    e.Result = checkAgainLater;
}
他不在意 2024-08-11 12:47:36

文章如何等待任何列表中的更改,等待当前项目的多个字段更改对于等待当前项目中的字段更改有不同的看法(下面的链接)。

本文介绍如何配置使用标准 (OOB) 工作流操作并使用 SharePoint Designer 开发的工作流。不是使用“等待当前项目中的字段更改”操作,而是将等待完成后完成的工作流组件添加到单独的“更改时”工作流,该工作流在第一步中使用标准条件来确定是否它可以继续。如果当前项目中的字段不满足条件,工作流程将停止。如果工作流的另一个实例正在运行,则在实例运行时将“Workflow_running”字段设置为“yes”,新实例也将停止。

使用此技术可以让您在等待满足特定条件时获得更多控制。这包括能够等待另一个列表项中的字段更新,或等待当前项中的多个字段。

请参阅如何要等待任何列表中的更改,请等待当前项目的多个字段更改(SharePoint 工作流) 了解更多详细信息。

The article How to wait for a change in any list, wait for multiple field changes the current item for a different take on waiting for field changes in the current item (link below).

The article explains how to configure a workflow which uses Standard (OOB) workflow actions and is developed using SharePoint Designer. Instead of using the "Wait for field change in the current item" action, the components of the workflow which are completed after waiting is finished are added to a separate "On Change" workflow, which uses standard conditions in the first step to determine if it can continue. If the conditions are not met for the field in the current item, the workflow will stop. If another instance of the workflow is running, new instances will also stop by setting a "Workflow_running" field to yes while an instance is running.

Using this technique gives you more control when waiting for specific criteria to be met. This includes being able to wait until a field in another list item is updated, or waiting for multiple fields in the current item.

See How to wait for a change in any list, wait for multiple field changes the current item (SharePoint Workflow) for more details.

绝不服输 2024-08-11 12:47:36

当使用一个工作流程进行审批并使用另一个工作流程更新字段时,您可以使用“等待当前项目中的字段更改”,以在审批完成后更新字段(已批准代码 16、已拒绝代码 17、正在进行代码 2)下面是一个示例:

等待 MomoApproval 等于 16,然后将通知设置为最终

此代码在批准后不会触发,因为 SharePoint 修改了与工作流相关的字段;该字段不属于列表的模式。因此,工作流状态的更改不会触发项目更改事件。如果没有项目更改事件,第二个工作流将保持空闲状态,并且“等待当前项目中的字段更改”操作似乎毫无用处,要绕过 SharePoint 2010 审批工作流的此行为,请执行以下操作:

  1. 打开 SharePoint Designer 2010
  2. 转到您要访问的网站正在处理
  3. 单击工作流程
  4. 右键单击​​审批工作流程
  5. 单击复制并修改
  6. 转到相关列表
  7. 单击关联现有工作流程
  8. 现在在此工作流程中,单击编辑工作流程,单击审批工作流程任务
  9. 单击更改单个任务的行为
  10. 转到完成部分并添加此操作“将标题设置为当前项目:标题”

这将更改列表架构中的标题字段,这将触发项目更改事件,但标题的值将保持不变,此操作不会对列表数据内容的影响。这是一个简单的解决方法,工作正常,并且与其他解决方案(例如创建活动、循环或暂停和重新启动工作流程)相比,成本更低。

创建工作流程后,可以将其导入到 Visual Studio 2010 中,并成为解决方案的一部分,请参阅此链接:http://msdn.microsoft.com/en-us/library/ ee231580.aspx

享受工作流程更新

注意: 更新字段的工作流程应在列表中出现项目更改时绑定启动。

穆罕默德·哈赫姆

When using one workflow for approval and another workflow for updating a field, you can use "Wait for field change in current item", to update field when the approval is made (either approved code 16, rejected code 17, In progress code 2) here is an example:

Wait for MomoApproval to equal 16 then set Notification to Final

This code will not fire when the approval is made because SharePoint modifies a field that is related to the workflow; this field does not belong to the schema of the list. Therefore, change on the workflow status does not trigger an item change event. Without an item change event the second workflow will remain idle and the "Wait for field change in current item" action will seem useless, to bypass this behaviour of SharePoint 2010 Approval workflow, do the following:

  1. Open SharePoint designer 2010
  2. Go to the site you are working on
  3. Click on workflows
  4. Right click on Approval workflow
  5. Click copy and modify
  6. Go to the concerned list
  7. Click associate existing workflow
  8. Now within this workflow, click edit workflow, click Approval workflow task
  9. Click change the behaviour of the single Task
  10. Go to the complete section and add this action "set Title to Current Item: Title"

This will change the title field within the schema of the list which will trigger an item change event but the value of the title is going to remain the same, this action will have no effect on data content of the list. This is simple workaround that work fine and that will cost less in comparison to other solutions such as creating an activity, looping, or pausing and restarting workflows

Once created the workflow can be imported to visual studio 2010 and be part of the solution please refer to this link : http://msdn.microsoft.com/en-us/library/ee231580.aspx

Enjoy your workflow updates

Note: The workflow that is updating the field should be bound to start when there is an item change within the list.

Mohamed Hachem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文