450 likes | 631 Views
Developing Workflows with SharePoint Designer. David Coe Application Development Consultant Microsoft Corporation. Agenda. What is a workflow? Comparing SPD and VSTS Break it down – SPD Workflows Explain Create Deploy Debug Demo – Approval with a twist. What is a Workflow?.
E N D
Developing Workflows with SharePoint Designer David Coe Application Development Consultant Microsoft Corporation
Agenda • What is a workflow? • Comparing SPD and VSTS • Break it down – SPD Workflows • Explain • Create • Deploy • Debug • Demo – Approval with a twist
What is a Workflow? • Natural way to organize and run a series of actions that correspond to a work process. • Can include both actions performed by people (“participants”) and actions performed by the workflow • Can be as simple or as complex as your business processes require.
More about Workflow • A series of activities • Think of it as a flow chart
How to Create A Workflow • Visual Studio • SharePoint Designer
Comparing SPD to VSTS VSTS • Code-behind file enables custom code • Workflow can be associated with multiple sites and lists • Workflow files compiled into assembly • Workflow defined as a SharePoint feature • Visual Studio debugging available • Can author both sequential and state workflows SPD • No code-behind file • Workflow is authored against and data-bound to specific list at design time • Association happens when workflow is authored • Workflow modifications are not available • Automatically handles deployment • No step-by-step debugging available • Can author only sequential workflows
K.I.S.S. • Kan I use SharePoint, sir? • Keep it Simple – use SharePoint Designer • That’s why we’re here
Advantages to SPD workflows • Workflows can be developed and tested rapidly. • Ease of deployment • Security issues are less complex • Can be deployed to servers where administrative policy prohibits custom code assemblies. • Can be created by users with less developer experience, such as Web designers or knowledge workers.
More advantages • Authoring that workflow directly against, and data-binding to, a specific list or document library • Predefined list of workflow activities • No code!
And still more … • Wizard-driven interface to assemble sequential workflows from predefined activities. • Each activity appears as an action, represented by a sentence that contains variables that the user can configure using drop-down menus and look-up dialog boxes. • Users can also select conditions, which are configurable conditional clauses that direct the flow of the workflow.
The trade-offs • Cannot be deployed to multiple lists. It is valid only for the list for which it was created. • Workflow modifications are not available in workflows authored in SharePoint Designer. • You cannot author against a content type in SharePoint Designer.
Where do these things live? • Stored in a site-level document library called Workflows. • Contains a folder for each workflow created with Office SharePoint Designer 2007. The folder contains all the source files necessary for the workflow, including: • The workflow markup (.xoml) file (needed only when the workflow uses conditions). • The workflow rules file. • The workflow configuration file. • Any .aspx forms needed, such as initiation forms or custom task forms.
What makes up a workflow? • Events • Actions • Conditions • Steps
What are Events? • An event is what starts or initiates a workflow • Three events that can start a workflow: • An item is created. • An item is changed. • A workflow participant clicks a start button on the SharePoint site. • Contribute permission required to start
Starting a Workflow • Participant starts manually • Started automatically when a list item is created or changed
demo Creating and Starting a Workflow
What are Actions? • The most basic unit of work in a workflow • Sample out of the box actions: • Create, copy, change, or delete list items (including documents). • Check items in or out. • Send an e-mail message. • Create a task for someone on the Tasks list of your team site. • Collect data from a participant that can be referenced later in the workflow. • Pause or stop the workflow.
More on Actions • A workflow can contain any number of actions. • Actions may performed by the workflow or participants. • In the most basic sense, when you design a workflow, you identify the necessary sequence of actions, and then you assemble that sequence of actions by using the Workflow Designer.
Parallel vs. Serial • When you have more than one action associated with a condition, the actions can be set up to run at the same time (parallel) or one after another (serial). • Serial: • Do this THEN that • Parallel • Do this AND that • Non-deterministic, order not guaranteed • Must be one or the other – not both
demo Actions
What are Conditions? • Rules that apply conditional logic to SharePoint lists and items. • A rule establishes a condition where the workflow performs the associated action only if that condition is true. • Example: • Sends reviewer an e-mail message only if an item is created by a specific person.
Conditions (cont) • You can also add clauses to a condition. • You can associate multiple actions with one condition. • To sum up, a rule is a condition associated with one or more actions: If all clauses in the condition are true, do all the associated actions.
But wait … • You can also create a branch that has no specific condition. • This way, the workflow performs one action if a condition is true and a different action if the condition is false. • Note: Branching in a workflow cannot extend from one step to another. A set of 'Else If' branches is always contained in a single step.
What Conditions Can I Use? • Is created or modified in a specific time span. • Is created or modified by a specific person. • Has a title field that contains specified keywords. • Is a file of a specific type or has a file size in a specific range. (This condition is available only when the workflow is attached to a document library.) • NOTE: An action does not require a condition.
demo Conditions
What are Steps? • Workflows are comprised of one or more steps. • Each step can contain any number of actions and associated conditions. • Steps allow you to group conditions and actions so that one set of rules (conditions and actions) can be evaluated and performed before a second set.
Steps (cont) • Some workflows can be designed either as a sequence of actions within one step, or as a sequence of steps.
Steps (cont) • How you structure your workflow into steps depends on what you want each step to accomplish. The rules in one step are processed to conclusion before going on to the next step. • Group as many rules necessary in the same step to effect the specific action or actions that you want. • IMPORTANT: Steps will keep evaluating until you introduce a pause or stop.
How WF Evaluates Steps • If a step contains only actions and no conditions, the workflow always performs those actions. • If a step has conditional branches, and each branch has a condition, the workflow performs an action only when the condition in one of the branches is satisfied. If no condition in any branch is satisfied, by default the workflow moves to the next step. • If a step has conditional branches, and each branch has a condition except for the last branch, the workflow performs an action only when the condition in one of the branches is satisfied. Else, if no condition is satisfied, the workflow performs the action in the last branch, which has no condition.
demo Steps
Workflow Forms • Forms are used to collect information from workflow participants at predefined times in the workflow, and make it possible for participants to interact with the tasks for that workflow. • Two types of forms • Initiation Form • Custom Task form
Initiation Form • Gathers information from participant when they start the workflow. • Displayed to users when they manually start a workflow on a given SharePoint item. • Users can specify additional parameters or information about the workflow as it applies to the given SharePoint item. • For example, you might use an initiation form to ask who should review a document and by when the review should be completed. • Not all workflows need initiation forms.
Custom Task Forms • Allows workflow participants to interact with tasks in the Tasks list on a SharePoint site. • Allows you to create custom form fields and add them to a custom task form. • The workflow can respond to those changes as specified in the tasks, or look up and evaluate that information in later steps of the workflow.
Customizing Forms • Workflow forms are ASP.NET pages with a Data Form Web Part and a master page applied to it. • These .aspx files are stored on the SharePoint site with the workflow source files. You can open and customize these forms as you would any other .aspx file. • Example: Prompting the user to verify they want to complete a task. • TIP: Watch out for pages that are over written!
Deploying Workflows • Click “Finish” – SPD does the rest. • No custom debugging functionality. • Deleting a workflow authored in SharePoint Designer from a list does not delete the actual source files.
Check the Status of a Workflow • The progress is reported via the browser in the All Items view, or any custom view with the workflow status column display (named after the workflow) • You can also click the item, go to Workflows, and see the history of workflows on the item
Debugging Workflows • No step-through debugging • Use the action “Log to Workflow History List” • Use this action when you want to keep a record of the workflow history for investigating errors or for tracking and repudiation purposes • Creates a list called “Workflow History” • Contains columns for such information as user ID, date, event, and error description.
Modifying Existing Workflows • Click Open Workflow on the File menu or double-click the .xoml file in the Folder List. • When you ‘re-deploy’ the workflow, all previous items will continue to run with their version of the workflow they started with. • To see versions of workflows, go to the list settings, then click on Workflow Settings.
Important Tips • Have a solid understanding of the business process before undertaking designing a workflow for it. This makes life A LOT easier. • Workflows run as the user who initiated the workflow – so if the workflow starts on the creation of a list item, the person who creates the list item is the initiator of the workflow.
More Tips • Workflows may error out when updating a list item • Either have InfoPath form closed • Pause for duration action • Wait for the timer to catch up before continuing
demo Approval with a Twist
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.