SharePoint State Machine Workflow Solution (ii): WF state Machine in SharePoint

Source: Internet
Author: User

In the previous article, we mentioned that SharePoint is a workflow platform that encapsulates the event-driven interface on top of the WF workflow engine; SharePoint extends a lot of activity on WF, where three common activities that are closely related to WF are: ONWORKFL Owactivated,createtask,ontaskchanged.

A simple SharePoint sequential stream.

onWorkflowActivated: Responds to events initiated by the process.

CreateTask: Create a SharePoint task.

Ontaskchanged: Respond to events that have been changed by the task.

There can be only one onworkflowactivated in a process; there may be any number of createtask and ontaskchanged, but must be pairs;

Many SharePoint workflow solutions, in sequential streaming mode, make the CreateTask and ontaskchanged a custom activity, and then take advantage of Replicatoractivity's automatic replication to support multiple people approving simultaneously. This way the process is concise, but the sequential flow does not support the fallback, the situation needs to be rolled back, only through the whileactivity simulation, the process will become very complex.

A simple SharePoint state machine

The process includes three states to start, approve, and complete, and then add other states to achieve a fallback between states.

onWorkflowActivated and setstateactivity are included in response to startup events

The add approver includes the CreateTask

Ontaskchanged and Setstateactivity are included in the response approval event

Each stateactivity of WF can contain only one stateinitializationactivity, which is used to add approvers and implement the business logic for initialization. Can contain multiple eventdrivenactivity to simultaneously respond to multiple approval events and to implement the business logic after approval; EventDrivenActivity's first control must be handleexternaleventactivity ( The base class of the ontaskchanged).

As we can see from the image above, the createtask and ontaskchanged still have to be aligned under the state machine, but their positions are separated, createtask in stateinitalizationactivity, ontaskchanged is in the eventdrivenactivity.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.