Condition Element (WorkflowInfo)
Applies to: SharePoint Foundation 2010
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 SharePoint Designer 2010.
When a workflow is triggered by an event that corresponds to a SharePoint list or document library item in Microsoft SharePoint Foundation 2010, 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 that are provided to it by the workflow editor.
Each Condition element also corresponds to a Boolean method inside a specified SharePoint Foundation 2010 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 Microsoft .NET assembly where the Condition code is implemented, and also 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 that is 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:
|
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" |
ItemKeyType |
Optional text. The implementation-specific identifier for the default object type. |
Name |
Required text. Specifies a localized condition name. |
Type |
Optional text. Specifies whether the Condition element is Custom or Advanced. The following values are not case-sensitive:
|
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
Parent Elements
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
WorkflowInfo Schema and WorkflowActions Schema Overview
Creating Declarative, No-Code Workflow Editors
WorkflowInfo Schema and WorkflowActions Schema Overview
Other Resources
Conditions Element