如何公开 SharePoint 工作流实例的状态?
我有一个相当简单的顺序审批工作流程,其中包含一个几乎涵盖整个工作流程的 EnableModificationActivity。 我的修改表单是一个 ASPX 页面,使用户能够启用/禁用工作流程中尚未发生的审批步骤。 由于工作流程可以多次修改,我希望表单能够反映工作流程的当前状态,这意味着它应该显示当前启用或禁用的活动。
我为此想出了一个笨拙的解决方案,稍后我将分享它,但我必须相信有一个干净的方法来解决这个问题。
I have a fairly straight-forward sequential approval workflow that has an EnableModificationActivity that is in scope for just about the entirety of the workflow. My modification form is an ASPX page that gives the user the ability to enable/disable approval steps that have not occurred yet in the workflow. Since the workflow is able to be modified multiple times, I would like to the form to reflect the current state of the workflow, meaning it should show which activities are currently enabled or disabled.
I have come up with a clunky solution for this that I will share a little later on, but I have got to believe there is a clean way to go about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,这是我最终采用的方法...
我创建了一个普通旧 CLR 对象 (POCO) 类,专门用于保存我的特定工作流程的状态信息,该工作流程能够进行 XML 序列化。 以后我将其称为“状态对象”。
我创建了一个名为“WorkflowStateManager”的可重用类,它能够为给定的 SPWorkflow 加载和保存单个状态对象。 此类可通过工作流程和修改表单访问。
激活工作流时,我构造一个新的状态对象,初始化其上的各种属性,并使用WorkflowStateManager。
随着工作流程的进展,我按照以下方式根据需要加载和更新状态对象:
现在,我的修改表单还能够使用 WorkflowStateManager 加载、操作和保存状态对象,进而向用户公开工作流的当前状态。
我希望这对某人有益。
So here is the approach I ended up taking...
I created a Plain Old CLR Object (POCO) class specific for holding state information my particular workflow that is capable of being XML Serialized. I'll call this the "State Object" going forward.
I created a reusable class called "WorkflowStateManager" that is capable of loading and saving single State Objects for a given SPWorkflow. This class is accessible by both the workflow and the modification form.
When the workflow is activated, I construct a new State Object, initialize various properties on it, and save it using the WorkflowStateManager.
As the workflow progresses, I load and update the State Object as needed in the following manner:
Now, my modification form is also able to load, manipulate, and save the State Object using the WorkflowStateManager, and in turn expose the current state of the workflow to the user.
I hope this might be of benefit to someone.