Share via


Condition Element (WorkflowActions)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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>

Attributes

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:

  • 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: 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: 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: 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:

  • 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: 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.

Child Elements

RuleDesigner

Parameters

Parent Elements

Conditions

Example

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

<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>

See Also

Concepts

Workflow Actions Schema Overview

Creating Declarative, No-Code Workflow Editors

Other Resources

Conditions Element