======= VariableDecisionHandler =======
The VariableDecisionHandler was previously called SmartformDecisionHandler. From [[en:software:tim:changelog:tim40|Version 4.0]] on, the action handler has been renamed to VariableDecisionHandler. However, it is still accessible via the class com.dooris.bpm.actionhandler.SmartFormDecissionHandler.
==== Description ====
The VariableDecisionHandler allows the user to pre-define the process path after an XOR gateway based on [[en:software:tim:process_variables|process variables]].
-----
==== Action Class ====
com.dooris.bpm.actionhandler.VariableDecisionHandler
\\
----
==== Parameters of the XOR gateway ====
== processVariable ==
Name of the process variable. The process path is selected based on the variable's value in the smartform.
== defaultTransition ==
The defaultTransition defines which process path is selected if the process variable is not defined.
== Action Name ==
The action name can be set arbitrarily.
==== Parameters of the outgoing sequence flows ====
== Condition expression ==
The condition expression can be set arbitrarily, but should resemble the decision (e.g. proposal status? Condition expression 1: Approved. Condition expression 2: Declined).
== ID ==
The ID is the value of the process variable set in the smartform (value="ID").
----
==== Example Customer Survey ====
By using the customer survey example, the usage of the VariableDecisionHandler is explained step by step. The customer survey is used to gain insight on how satisfied customers are with TIM. The VariableDecisionHandler is necessary to check whether a participant provided contact information. The subsequent process flow is altered based on this decision (see screenshot).
{{:software:tim:actionhandler:variableDecisionHandler3.PNG?600 }}{{ :software:tim:actionhandler:variableDecisionHandler4.PNG?600 }}
The VariableDecisionHandler is placed on an XOR gateway in the respective process modelling application. Several parameters are required in addition to the action handler class. The parameters refer to the input fields in the smartform. For XOR gateways, the relevant input fields are usually radio buttons (e.g. approve or decline a proposal).
{{en:software:tim:actionhandler:variableDecisionHandler1_en.PNG}}
The name of the relevant process variable is written in the field **processVariable** (name=„helper“). Subsequently, the path that should be taken based on a respective value is determined. The path with the condition expression **No** is selected if a participant does not provide contact information. In other words, the radio button with the value **noemail** is selected. If a participant provides contact information, the radio button with the value **email** is selected (see screenshot, value="email"). Thus the process path with the condition expression **Yes** is pursued.
{{en:software:tim:actionhandler:variableDecisionHandler2_en.PNG}}
The following screenshot shows relevant code of the customer survey form. Note the two radio buttons, one with the name **helper** (name="helper") and the other with values **email** / **noemail**. These two input fields are crucial for the process proceedings, as described above.
{{:software:tim:actionhandler:variableDecisionHandler1.PNG}}
==== Special case Domrepeater ====
The Domrepeater enables the creation of smartform input fields during the runtime. A prominent example is the creation of additional rows in a table. If the VariableDecisionHandler refers to a input field that can be manipulated with the Domrepeater, a new VariableDecisionHandler would have to be defined for each additionally created input field. To avoid this tedious task, the following parameters were added.
== repeat ==
The parameter repeat serves as a counter that contains the number of process variable occurrences generated by the Domrepeater.
==variableNameRepeating ==
variableNameRepeating contains of the name of the relevant process variable.
{{en:software:tim:actionhandler:variableDecisionHandler3_en.PNG}}