The basic steps of creating a workflow are always the same: First you define the workflow, and then you create the rules by choosing conditions and actions.
- On the File menu, click Open Site.
- In the Open Site dialog box, browse to and select the SharePoint site where you want to create the workflow, and then click Open.
- On the File menu, point to New, and then click Workflow.
The Workflow Designer opens.
- In the Give a name to this workflow box, type a name for this workflow.
Site visitors will see this name when they view
the Workflow Status and Workflows pages in the browser. By default, new
workflows are automatically named Workflow 1, Workflow 2, and so on.
- Click an option in the What SharePoint list should this workflow be attached to? list.
You must attach your workflow to a SharePoint
list or document library. Which list you attach the workflow to
determines where the workflow participants start the workflow. For
example, if you want a workflow to start when an item is created or
changed in Shared Documents, choose that library. The attached list is
where you go to check workflow status and history, or to manually start a
workflow.
Note Workflows that
start automatically when an item is created or changed can run in
infinite loops, which you want to avoid. For example, a workflow that
starts when an item is changed should never change an item in the list
that it is attached to. A workflow that starts when an item is created
should never create an item in the list that it is attached to. This is
also an issue with multiple workflows. For example, Workflow A is
attached to List A, and Workflow B is attached to List B. Both workflows
start automatically when a new item is created. Workflow A creates an
item in List B, and Workflow B creates an item in List A. Such a
scenario creates an infinite loop. A best practice is to know what
workflows are already running on any lists or libraries where your
workflow creates or changes items.
- Under Select workflow start options for items in this list, do one or more of the following:
- Select the Allow this workflow to be started manually from an item check box.
This option adds a Workflows command to a list item so that users can click the command to start the workflow for that item. - Select the Automatically start this workflow when a new item is created check box.
- Select the Automatically start this workflow whenever an item is changed check box.
Note You can select two
or three options, but you must select at least one option if you want
to run the workflow. If you do not select an option, you can design the
workflow and then click Finish, but the workflow cannot be initiated. Later, you can open the workflow (File menu, Open Workflow command), select an initiation option, and then click Finish. This is useful for saving a workflow that you are in the process of designing.
- Click Next.
- In the Step Name box, type a name for the first step of your workflow.
Now you create the rules for your workflow by
choosing the actions that you want it to perform and any conditions that
must be satisfied for those actions to occur.
Note Not every step
must contain a condition; for example, you can have steps that are
simply a list of actions to be performed. However, every step can have
at most one conditional branch that contains an action without an
associated condition. This is because a conditional branch that does not
have a condition acts as the "Else" branch in an "Else If" conditional
branch. If condition A is true, do action B; otherwise — else — do
action C. As such, it would not make sense to have more than one "Else"
branch because the last branch would never be reached.
- For each condition that you want to specify, click Conditions, and then click that condition in the list. Repeat until you have specified all of the conditions that you want to include.
Note You can choose more than one condition. If you do, the conditions are joined by and,
meaning that all the conditions must be satisfied before the workflow
does the associated actions. Multiple conditions create a progressive
filter in which the order matters because the first condition is
evaluated first. To move a condition up or down in a list of conditions,
click the condition, click the down arrow that appears, and then click
either Move Condition Up or Move Condition Down in the list.
Office SharePoint Designer 2007 provides a number
of predefined conditions. In addition, you can create advanced and
custom conditions. With custom conditions, you can compare a field in
the current list with a value. With advanced conditions, you can compare
one value to another value. This allows you to create a comparison
between a field in any list and a value from a wide range of sources.
- After you insert a condition, click each hyperlink, and then choose a value for the required parameters.
For example, a condition might include links for choosing a field in the list, a comparison, and a value.
- For each action that you want to include, click Actions, and then click that action in the list. Repeat until you have specified all of the conditions that you want to include.
If this action does not appear in the list, click More Actions, click the action that you want, and then click Add.
Note You can create
more than one action for a condition. If you do, the actions can run
either one after another (joined by "then") or at the same time (joined
by "and"). To switch between running in sequence and running in
parallel, click the arrow in the upper-right corner of the rule, and
then click either Run All Actions in Sequence or Run All Actions in Parallel.
- After you insert an action, click each hyperlink, and then choose a value for the required parameters.
For example, an action might include a link for creating an e-mail message.
- If you want to add a conditional branch, click Add 'Else If' Conditional Branch, and then repeat steps 9–12 to create another rule.
A rule is a set of related conditions and
actions, as shown in the previous illustration. When the condition is
true, the workflow does the associated actions. But what if the
condition is not true? By adding conditional branches, you can specify
additional conditions. For example, you can create three different
conditions for when a document status is changed to Approved, Rejected,
or Pending. You can also create an Else condition, where the workflow
performs the action only when none of the previous conditions have been
satisfied. To create an Else condition, the last rule in the step must
be an action with no conditions. The workflow evaluates all the
conditions; if none of them are satisfied, the workflow performs any
actions in the final branch, which has no condition.
- When this step of the workflow is complete, click Next.
- For each step in the workflow, repeat steps 8–14 to create additional sets of conditions and actions.
As you add steps, keep in mind that each step can
hold only one set of 'Else If' conditional branches, where the actions
in each branch are performed only when the associated condition is
satisfied. In this case, you must add additional steps when:
- Multiple sets of 'Else If' conditional branches need to be evaluated.
- You need to separate a branched statement from a non-branched statement.
- To check the workflow for errors before you exit the Workflow Designer, click Check workflow.
If there is a workflow error, the hyperlink
changes color and asterisks appear before and after the invalid
parameter. In addition, under Workflow Steps, an error
symbol appears next to each step that contains an error. For each
error, check to make sure that the parameters entered are valid.
- Click Finish. The workflow is saved and attached to the list that you specified.
Note You cannot change
which list a workflow is attached to after you save the workflow.
Instead, you must create a new workflow and attach it to the list that
you want.
0 comments:
Post a Comment