Workflow Foundation (Wf) Presentation


Published on

Introduction to Workflow Foundation (WF) using Microsoft Office SharePoint Server (MOSS 2007)

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Workflow Foundation (Wf) Presentation

  1. 1. Presentation by Mark Bauman .NET Developers Group
  2. 2. What is Workflow? <ul><li>In general terms workflow is: </li></ul><ul><li>Work to do (activities) and the related business process flow </li></ul><ul><li>A term used to describe activity tasks, procedural steps, and the people involved with the process </li></ul><ul><li>A word that generates 3,670,000 hits on Google </li></ul>
  3. 3. Some Workflow Scenarios <ul><li>Financial team document review and approval process </li></ul><ul><li>IT incident open form with on-call email alerts and form archival </li></ul><ul><li>Automated document move from public SharePoint library to controlled permissions based library </li></ul><ul><li>Document expiration date move to archive repository </li></ul><ul><li>Calendar event driven workflows </li></ul><ul><li>Shopping cart workflow </li></ul>
  4. 4. Microsoft Workflow Overview <ul><li>Workflow Foundation (WF) is a Microsoft technology for defining, executing, and managing workflows. This technology was first released as a part of the .NET 3.0 Framework </li></ul><ul><li>Workflow is a process that defines and controls the completion of one or more tasks. Workflows typically fall under 2 categories: Human-centric (people participation) and Machine-centric (system based) </li></ul><ul><li>WF enabled applications use a declarative programming model rather than a procedural one, separating what to do from when to do it </li></ul>
  5. 5. Microsoft Workflow Overview <ul><li>A Workflow is not directly executable. It is designed only to exist within another process called the host </li></ul><ul><li>Hosts include: </li></ul><ul><li>SharePoint (MOSS/WSS) </li></ul><ul><li>Windows console applications </li></ul><ul><li>Windows service applications </li></ul><ul><li>Windows forms (WinForms) applications </li></ul><ul><li>Windows Presentation Foundation (WPF) applications </li></ul><ul><li>ASP.NET web applications </li></ul><ul><li>WF is a set of objects that expose functionality, WF does not expose a user interface (UI). The host exposes the UI to create and manage the workflow </li></ul>
  6. 6. Workflow Authoring/Publishing <ul><li>Workflows can be created via: </li></ul><ul><li>SharePoint out-of-the-box: (no-code OOTB). Standard templates include: Approval (routes a document for approval), Collect Feedback (routes a document for review), Collect Signatures (gathers signatures), Disposition Approval (manages document expiration and retention) </li></ul><ul><li>SharePoint Designer: (no-code rules based). SPD has a limitation of a single document library or list in a single SharePoint site. Published as xoml rules file. </li></ul><ul><li>Visual Studio: (code/rules). VS workflow is typically installed as a feature that can be used across multiple SharePoint sites </li></ul>
  7. 7. Workflow Lifecycle <ul><li>The life cycle of the workflow instances are managed by the workflow runtime </li></ul><ul><li>The WF runtime is responsible for creating, executing, threading, persisting, tracking, communicating execution events, and coordinating transactions </li></ul>
  8. 8. Workflow Architecture
  9. 9. Core WF Namespaces Namespace Description Location System.Workflow.Activities WF Base Activities GAC System.Workflow.ComponentModel WF Core base classes GAC System.Workflow.Runtime WF Runtime GAC System.WorkflowServices WF Services GAC Microsoft.SharePoint.WorkflowActions SharePoint WF Activity Library C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12ISAPI
  10. 10. Visual Studio Code Files <ul><li>Visual Studio main workflow files: </li></ul><ul><li>Workflow1.cs contains the business logic </li></ul><ul><li>Workflow1.designer.cs contains the model definitions </li></ul><ul><li>Workflow1.rules contains the serialized rule definitions (stored as an embedded resource in the compiled assembly) </li></ul>
  11. 11. Location of SharePoint Assembly References <ul><li>SharePoint assemblies located in C:Program FilesCommon Filesmicrosoft sharedWeb Server Extensions12ISAPI directory </li></ul>
  12. 12. Workflow Activities <ul><li>Activities are the building blocks for workflows, and are .NET components. They are the steps in a workflow. </li></ul><ul><li>Activities inherit from the Activity class or the SequenceActivity class </li></ul>
  13. 13. Types of Activities <ul><li>There are simple and composite activities. Simple usually does one thing, like send email. Composite activities act as a container for other activities, such as IfElse </li></ul><ul><li>Activity categories include: Event Handling, Flow Control, Rules, State Management, Workflow Services, Transactions, Custom Workflow Logic, Exception and Error Handling, etc. </li></ul><ul><li>There are SharePoint WF Activities, .NET 3.0 Activities, and .NET 3.5 Activities for WCF </li></ul>
  14. 14. Sequential Workflow <ul><li>There are 2 types of workflows: Sequential and State Machine </li></ul><ul><li>Sequential Workflow (linear: progresses from one activity step to next and does not step back) </li></ul>
  15. 15. State Machine <ul><li>State Machine Workflow (Progresses from State to State: are more complex and can return to a previous step if required) </li></ul>
  16. 16. SharePoint WF Template/Deployment <ul><li>SharePoint extends WF by introducing the concept of a workflow template/feature </li></ul><ul><li>VS 2008 has a deploy tool </li></ul><ul><li>VS 2005: deploy a custom SharePoint workflow by installing the assembly dll into the GAC, install the feature.xml and workflow.xml files, install the feature via the stsadm.exe, and then activate the feature in the site collection </li></ul>
  17. 17. Correlation Tokens <ul><li>The correlation token is the mechanism the workflow runtime uses to identify the running instance of the workflow </li></ul><ul><li>Correlation token properties ensure that the single activity object is operating on the correct payload instance and accessing the correct details about the workflow </li></ul>
  18. 18. Workflow Rules <ul><li>WF provides a general-purpose rules engine </li></ul><ul><li>Rules provide another way to implement business logic that complements code and activities </li></ul><ul><li>Rules are organized into logical groupings know as rule sets </li></ul><ul><li>Rules are stored in the .rules file and are embedded in the assembly </li></ul>
  19. 19. Workflow Persistence <ul><li>Workflows persist when they hit an idle or wait state </li></ul><ul><li>For SharePoint, the workflow is persisted in the dbo.Workflow and dbo.WorkflowAssociation tables in the SharePoint content database </li></ul><ul><li>Non-SharePoint hosts need to build their own tables first and then use the SqlWorkflowPersistenceService or WorkflowPersistenceService. Need to build the tables using SqlPersistenceService_Logic.sql and SqlPersistenceService_Schema.sql scripts. </li></ul>
  20. 20. Workflow Tracking <ul><li>Enables hosts to observe workflow instances during execution by capturing events that are raised during workflow execution </li></ul><ul><li>Workflow has one primary service which is SqlTrackingService </li></ul><ul><li>Built in tracking is actually divided in three parts: Activity Tracking, Workflow Tracking, and User Tracking </li></ul>
  21. 21. Workflow SharePoint UI Forms <ul><li>SharePoint can have any of the following Workflow forms: </li></ul><ul><li>Association form, Initiation form, Modification form, Task Edit form </li></ul><ul><li>Can create custom forms via InfoPath or ASP.NET </li></ul>
  22. 22. Workflow Debugging <ul><li>The WF design and runtime tools include an integrated workflow debugger which attaches to w3wp worker process to debug </li></ul><ul><li>Be careful not to debug workflows on SharePoint production servers. While you are debugging your workflow, with break-points enabled, your SharePoint Site will be “halted” for other users </li></ul>
  23. 23. Setting up Visual Studio <ul><li>VS 2008 includes WF Extensions </li></ul><ul><li>Install WF Project Extensions for VS 2005 </li></ul><ul><li>VS needs to be installed on a MOSS instance for SharePoint WF development </li></ul>
  24. 24. Useful Links <ul><li>MSDN Workflow Videos: </li></ul><ul><li> </li></ul><ul><li>MSDN Windows Workflow Foundation: </li></ul><ul><li> </li></ul><ul><li>MSDN Workflow SharePoint Services Overview: </li></ul><ul><li> </li></ul><ul><li>MS SharePoint Team Blog – Workflow: </li></ul><ul><li> </li></ul>
  25. 25. Demos <ul><li>SharePoint out-of-the-box </li></ul><ul><li>SharePoint Designer </li></ul><ul><li>Visual Studio </li></ul>