Sharepoint工作流程问题
我有自定义审批状态机器工作流程,此工作流程附加到列表,并在根据要求添加或更改任何项目时启动,当我的工作流程达到发布状态时,我编写自定义代码以将其审核状态更改为“已批准”,然后工作流程完成(项目状态)将根据我的需要进行更改)但是我的工作流程再次作为新实例启动的问题:(。
I have custom approval state machibe workflow , this workflow attached to list and enabled to start when any item added or changed according to requirements, when my workflow reached publish state i write custom code to change it's Moderation status to Approved then workflow finished (item state will changed as i want ) but the problem that my workflow start as new instance again :( .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我理解您的问题,您就有一个从添加或更改开始的工作流程。 但在某些情况下,项目会发生更改,而您不希望工作流程启动。 您无法在代码中启动工作流程,因为您需要最终用户将您的工作流程添加到自己的列表中。
唯一的选择是让工作流中的第一个活动进行检查以查看工作流实例是否应该运行。 如果没有,则退出工作流实例。 如果您在 SharePoint Designer 中构建工作流并且没有此类活动,则可以在 Visual Studio 2008 中为此构建自定义活动,然后将其与 SharePoint Designer 一起使用。 如果您在 Visual Studio 2008 中构建整个工作流程,那么您可以在 Visual Studio 中创建一个自定义活动来使用它。
If I understand your question you have a workflow that starts on add or change. But there are some circumstances where the item changes where you do not want the workflow to start. You cannot start the workflow in code because you need end users to add your workflow to lists themselves.
The only option then is to have the first activity in the workflow do checks to see if the workflow instance should be running. If not, exit the workflow instance. If you're building the workflow in SharePoint Designer and don't have such an activity you can build a custom activity for this in Visual Studio 2008 and then use that with SharePoint Designer. If you are building the whole workflow in Visual Studio 2008 then you can create a custom activity in Visual Studio to use with it.
您有两个选择:
1) 保持工作流程在添加或更改时启动,并将活动添加到工作流程的开头,以检查审核状态,如果已获得批准,则立即退出。
2) 让工作流程从您编写的事件接收器中的代码启动,并在启动之前检查该项目。
You have two options:
1) Keep the workflow as starting on added or changed and add activities to the start of the workflow which check the Moderation status and exit immediately if it is already approved.
2) Have the workflow start from code in an event receiver you write and check the item before starting it.
我创建了一个小解决方案来解决这个问题。 我创建了预最终状态,它直接重定向到最终状态。 然后我在此状态下创建一个自定义代码活动并编写其代码:
我的问题已解决:)
I have created a small work around to fix this problem. I have created pre-final state which redirects to the final state directly. Then I create a custom code activity in this state and make its code:
and my problem is fixed :)