編輯

共用方式為


Condition element

(Conditions element) (WorkflowInfo element) (Action4)

Applies to: SharePoint Server 2013

Represents a Condition statement, which is part of a rule sentence that can be displayed in a declarative, rules-based, code-free workflow editor. The Condition statement (with values and arguments) is used to evaluate workflow state and make branching decisions.

Usage

    <WorkflowInfo>
          <Conditions>
                <Condition>
                   <RuleDesigner />
                   <Paramaters />
                </Condition>
                <Default />
          </Conditions>
          <Action />
    </WorkflowInfo>

Element information

Name Value
Element type
Namespace
Schema file Actions4.xsd

Definition

    <xs:element name="Condition"      minOccurs="0"     maxOccurs="unbounded"    >
               <xs:complexType>
               <xs:all>
         <xs:element name="RuleDesigner"      type="ruleDesignerType" minOccurs="1"     maxOccurs="1"    >
      </xs:element>
         <xs:element name="Parameters"      type="parametersType" minOccurs="1"     maxOccurs="1"    >
      </xs:element>
           </xs:all>
         <xs:attribute name="Type"   type="s:string"     />
         <xs:attribute name="Name"   type="s:string"      use="required"     />
         <xs:attribute name="AppliesTo"   type="appliesToTypes"      use="required"     />
         <xs:attribute name="UsesCurrentItem"   type="s:boolean"     />
         <xs:attribute name="ItemKeyType"   type="s:string"     />
         <xs:attribute name="FunctionName"   type="s:string"     />
         <xs:attribute name="Assembly"   type="s:string"     />
         <xs:attribute name="ClassName"   type="s:string"     />
         <xs:attribute name="ShapeImageUrl"   type="s:string"     />
           </xs:complexType>
      </xs:element>

Elements and attributes

If the schema defines specific requirements, such as sequence, minOccurs, maxOccurs, and choice, see the definition section.

Parent elements

Element

Type

Description

Conditions


Child elements

Element

Type

Description

Parameters

parametersType

RuleDesigner

ruleDesignerType


Attributes

Attribute

Type

Required

Description

Possible values

**AppliesTo**

appliesToTypes

required

Specifies whether 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. Following are allowable values:

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

  • **list** specifies that a condition statement is visible to the workflow editor only when the workflow is associated with a SharePoint list.

  • **none** specifies that a condition statement is hidden from the workflow editor.

Values of the appliesToTypes type.

**Assembly**

s:string

optional

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

Example:

```Assembly="Microsoft.SharePoint.WorkflowActions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=c9b3ceac-xxxxx-xxxxx-xxxxx-xxxxxxxxxxxx"```

Values of the s:string type.

**ClassName**

s:string

optional

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

Values of the s:string type.

**FunctionName**

s:string

optional

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

Example method:

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

XML:

`FunctionName="myCondition"`

Values of the s:string type.

**ItemKeyType**

s:string

optional

The implementation-specific identifier for the default object type.

Values of the s:string type.

**Name**

s:string

required

Specifies a localized name of the condition.

Values of the s:string type.

**ShapeImageUrl**

s:string

optional

The URL to the image file representing the condition-related shape that is represented in the visual designer.

Values of the s:string type.

**Type**

s:string

optional

Specifies whether the **Condition** element is **Custom** or **Advanced**.

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

Values of the s:string type.

**UsesCurrentItem**

s:boolean

optional

Specifies whether the item currently selected is associated with the workflow. 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 workflow editor or designer surface, this value always returns **true** and cannot be changed.

Values of the s:boolean type.

Remarks

Each Condition element also corresponds to a Boolean method inside a specified SharePoint 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.