Designer > Implementing a BPMN Gateway or Control Flow > If
  

If

BPMN Implementation: Conditional Pattern
An If container executes an activity based on one or more conditions defined by the If and optional Else If elements, followed by an optional else element. The conditions are evaluated in order, and the first one to evaluate to true has its activity executed. The if container is a good choice if all conditionals can be evaluated to a true or false condition.
If you do not define a branch, an implied Else executes an empty activity.
See also Ungrouping Selected Structured Activities.
Required Properties
Optional Properties
If Condition
Name. See Selecting Activity Labels
Join Condition. See Creating a Join Condition for an Incoming Link
Suppress Join Failure. See Process Properties
Comment. See Adding Comments to a Process
Documentation. See Adding Documentation to a Process
See Setting Visual Properties and Using Your Own Library of Images.
Execution State. See Viewing the Execution State of an Activity or Link
Extension Attributes and Extension Elements. See Declaring Extension Elements and Attributes.
To build an If:
  1. 1. From the Control Flow palette, drag a Conditional Pattern activity to the Process Editor canvas.
  2. 2. Double-click the If Condition container to open the Expression Builder.
  3. Alternately, in the Properties view, click the Dialog (...) Button next to If Expression.
  4. 3. Select the variables, functions and operators to build a Boolean expression. For details, see Using the Expression Builder.
  5. 4. From the Activity palette, drag an activity to the If Condition container, and select activity properties.
  6. 5. Repeat Steps 2 through 5 for the Else If or Else branches, if desired.
The following illustration shows an example of an If activity.
XML Syntax
<if standard-attributes>
standard-elements
<condition expressionlanguage="anyURI"?>
bool-expr
</condition>
activity
<elseif>*
<condition expressionlanguage="anyURI"?>
bool-expr
</condition>
activity
</elseif>
<else>?
activity
</else>
</if>
Example:
<if xmlns:inventory="http://supply-chain.org/inventory"
xmlns:FLT="http://example.com/faults">
<condition>
bpel:getVariableProperty('stockResult',
'inventory:level') > 100
</condition>
<flow>
<!-- perform fulfillment work -->
</flow>
<elseif>
<condition>
<bpel:getVariableProperty('stockResult',
'inventory:level') >= 0
</condition>
<throw faultName="FLT:OutOfStock"
variable="RestockEstimate" />
</elseif>
<else>
<throw faultName="FLT:ItemDiscontinued" />
</else>
</if>