Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Server Technologies
SDK Documentation
General Reference
 Condition Element (WorkflowActions)
Condition Element (WorkflowActions)

Represents a Condition statement, which is part of a rule sentence that can be displayed in a declarative, rules-based, code-free workflow editor, such as Microsoft Office SharePoint Designer 2007.

When a workflow is triggered by an event corresponding to a SharePoint list or document library item in Windows SharePoint Services 3.0, it is often necessary to evaluate what workflow action should be taken or if an action is required. A Condition element allows the workflow to perform this evaluation with the values and arguments provided to it by the workflow editor.

Each Condition element also corresponds to a Boolean method inside a specified Windows SharePoint Services 3.0 workflow library. These methods are used to evaluate values passed by their parameters and return either true or false.

A Condition element contains information about the .NET assembly where the Condition code is implemented, as well as the parameters that are required to make the function call. It also contains information about how the Condition statement should be displayed to the workflow editor.

<WorkflowInfo>
      <Conditions>
            <Condition>
               <RuleDesigner>…</RuleDesigner>
               <Paramaters>…</Parameters>
            </Condition>
            <Default>…</Default>
      </Conditions>
      <Action>…</Actions>
</WorkflowInfo>
Attribute Description

AppliesTo

Required text. Specifies that the conditional statement being evaluated is applied to a SharePoint list or document library. By changing the value, you can show or hide a specific condition statement in the workflow editor, depending on the type of SharePoint list that the workflow is associated with.

The following values are not case sensitive.

Value Description

all

Specifies that a condition statement is available to all list and document library types.

doclib

Specifies that a condition statement is visible to the workflow editor only when the workflow is associated with a document library. If the workflow is associated with any other type of list, the condition statement is hidden from the workflow editor.

list

Specifies that a condition statement is visible to the workflow editor only when the workflow is associated with a SharePoint list. If the workflow is associated with any type other than a list type, the condition statement is hidden from the workflow editor.

none

Specifies that a condition statement is hidden from the workflow editor.

Assembly

Required text. Specifies the .NET assembly that contains the implementation code for the Condition element.

Value Type Description

String

Specifies the .NET assembly that contains the workflow code. The format should be as follows:

Assembly name, Version, Culture, PublicKeyToken

Example:

Assembly="Microsoft.SharePoint.WorkflowActions,

Version=12.0.0.0,

Culture=neutral,

PublicKeyToken= 71e9bce111e9429c"

ClassName

Required text. Contains the fully qualified class name in which the Condition element code is implemented.

Value Type Description

String

Fully qualified class name in which the custom Condition element code is implemented. Example:

XML:

ClassName="Microsoft.SharePoint.WorkflowActions.Helper"

FunctionName

Required text. Name of the Boolean method in the class that implements the Condition code.

Value Type Description

String

Represents the method name in the class in which the Condition element code is implemented.

Example method:

Bool myCondition(WorkflowContext context, string ListGUIDorName, int ItemWorkflowAttachedTo)

XML:

FunctionName="myCondition"

Type

Optional text. Specifies whether the Condition element is Custom or Advanced.

The following values are not case sensitive.

Value Description

Custom

Used to compare a value found in the current SharePoint list or document library item to a value specified by the workflow designer.

Advanced

Used to indicate that a Condition can be used to compare two values of any type (for example, text, integers, and dates).

UsesCurrentItem

Optional Boolean. Specifies that the item currently selected is associated with the workflow.

Value Type Description

Boolean

If set to true, the workflow binds to the SharePoint list item or document library item that started the workflow instance. When using a declarative, code-free workflow editor, this value always returns true and cannot be changed.

The following example shows how to expose a Condition element to the code-free editor during the workflow design process.

Xml
<WorkflowInfo Language="en-us">
   <Conditions And="and" Or="or" Not="not" When="If" Else="ElseIf">
      <Condition 
              AppliesTo="list" 
              Assembly="MyWorkflowProject.Workflow1,
                        PublicKeyToken=71e9bce111e9429c,
                        Version=1.0.0.0,
                        Culture=neutral" 
              ClassName="MyWorkflowProject.Workflow1.MyClass"
              FunctionName="IsOrderComplete" 
              Name="Check if item in %1 is a complete order"
              Type="Custom"
              UsesCurrentItem="True">
          <RuleDesigner>...</RuleDesigner>
      </Condition>
   </Conditions>
</WorkflowInfo>
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker