Construction allows directing workflow using different scenarios depending on the specified conditions.
Condition check starts from left to right. When condition is met, the activities located under it will be executed. When a condition is not met, switches to condition located to the right progressing until satisfying the condition.
Condition type - PHP code
In this case, condition is
PHP code
Only user with admin access permission can set PHP code.
. When specified PHP code returns true, executes the condition activity branch. If returns false, switches to the next condition.
Attention! Only PHP-code can be used for this condition type. Parameters type {=Variable:Variable2_printable} are not supported.
Also, result of executed code inside the condition can be the logical expression (true or false).
Condition type - element field
Activity branch will be executed when meeting the parameters associated with element fields.
Condition type - Variable value
Condition activity branch
will be executedNote: Both variables and template parameters can be used in this type.
, if parameters associated with workflow variables match.
Condition type - True
Activity branch is executed directly. This condition is executed at all times.
Condition type - Modified
If workflow is launched upon element edit, modified fields can be defined inside it. Condition branch
will be satisfiedNote: This condition type can be applicable only after additional module configuration.
, if the field was somehow edited.
How to configure this condition type (for developer)
To use this type of condition, configuration for the module handling the workflow must be updated. Upon workflow start, pass the array of modified fields via the parameter CBPDocument::PARAM_MODIFIED_DOCUMENT_FIELDS:
For the new condition to be displayed in editor config, implement its support within the element:
public static function isFeatureEnabled($documentType, $feature)
{
return in_array($feature, array(\CBPDocumentService::FEATURE_MARK_MODIFIED_FIELDS));
}
Attention! If none of conditions are satisfied, workflow will continue to execute activities located under the Conditions structure. In other words, it will skip it.
Merging conditions
For Element field and Variable Value condition type can have merged conditions by the rule AND / OR. Selecting AND the condition branch will be executed upon satisfying both conditions, and with OR - any of the listed.