Bitrix24 Helpdesk

Activities: Flow Control

Flow control activities help you manage how a workflow runs. You can pause execution, branch logic, run steps in parallel, or repeat actions.

Wait for Event

This activity pauses the workflow and waits for a user action.

Before adding this activity, use User notification. This helps users understand that they need to respond to continue the workflow.

The only parameter is The event can be sent by. Select the group of users who are allowed to run the command.

When the workflow reaches this step, it stops. It resumes only after a user selects how the process should continue.

To run a command:

  1. Go to Automation > Workflows.
  2. Open the required element.
  3. Open the Business Processes tab.
  4. Find the command next to Run Action.
  5. Click Execute Commands.

Condition

Use this activity to route a workflow into different branches based on conditions.

Available condition types:

Element Field. Runs a branch if element field values match the condition.

Variable Value. Runs a branch if workflow variables match the condition. You can also use template parameters here.

Mixed. Combine multiple sources in one condition. You can check variables, element fields, and constants without creating separate branches.

True. Always runs. Use it as a fallback when no other conditions match. Place this branch last.

PHP Code (On-Premise only). Runs a branch if the PHP expression returns true. If it returns false, the system checks the next condition.

Notes:
  • Only administrators can configure this type.
  • Use only PHP code. Parameters like {=Variable:Variable2_printable} are not supported.

Modified Document Fields (On-Premise only). Runs a branch if specific fields were changed. Available only after additional module setup.


How conditions work

Conditions are checked from left to right. The first matching condition runs its branch.

If no condition matches, the workflow skips the condition block and continues with the next steps.


Set up Modified Document Fields (for developers)

To use this condition type, configure the module and pass modified fields when starting the workflow:

CBPDocument::StartWorkflow( $arDocumentState["TEMPLATE_ID"], BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array_merge($arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], array( CBPDocument::PARAM_TAGRET_USER => "user_".intval($GLOBALS["USER"]->GetID()), CBPDocument::PARAM_MODIFIED_DOCUMENT_FIELDS => $modifiedFields )), $arErrorsTmp ); 

Then enable support for this feature in the document:

 public static function isFeatureEnabled($documentType, $feature) { return in_array($feature, array(\CBPDocumentService::FEATURE_MARK_MODIFIED_FIELDS)); } 
Attention! If no condition is met, the workflow will continue executing the activities under the condition structure. In other words, it will skip the structure.

Listening for Parallel Event

Use this structure to route a workflow based on which event happens first.

The workflow runs multiple branches at the same time. As soon as an event occurs in one branch, the workflow continues from that branch.

To control the flow, use:

  • Wait for Event
  • Pause Execution

The Pause Execution activity lets you resume the workflow after a set time if no action is taken. If you do not use it, the workflow will wait until a command is executed in one of the branches.

Parallel Execution

This activity runs multiple branches at the same time.

The workflow waits until all branches finish. If one branch does not complete, the workflow pauses until it does.

Set Status

This activity changes the workflow status.

It is available only in status driven workflows.

Use Abort current status to move an item to the selected status right away. The workflow does not wait for the current status to finish.

Iterator

This activity loops through multiple values and runs actions for each one.

Select a multiple-value variable, element field, or constant in the activity parameters.

You can then add a set of actions that will run for each selected value, one by one.

Example:
You have a Link to Employee variable with a list of account users. You need to create a task for each user. To do this, select the variable in the iterator parameters and add the Create task activity to the structure.

To use the next value in each loop, insert Value from the Additional Results of Iterator.

While Loop

A loop runs while a condition is true. For example, you can use it to send notifications to all employees in a department until everyone gets the message.

All activities inside the loop run in one step, even if the condition changes while they run. When the step is complete, the loop checks the condition again:

  • If the condition is true, the loop continues.
  • If the condition is false, the loop stops.
Do not use the Email message activity when you test a While Loop. If the loop repeats by mistake, the system may send 1,000 emails from your account. You cannot stop them after the loop starts.

Test the While Loop carefully before you use it to send emails.

Parameters

Title. The name shown in the workflow designer.

Condition Type. Select the condition type you need:

  • Element field: Checks values in workflow element fields.
  • Mixed: Checks several sources in one condition, such as variables, element fields, and constants.
  • True: Runs the loop right away without checking a condition.
  • PHP code: Uses PHP to define the condition. Only an administrator can set it up. This option is available only in Bitrix24 On-Premise.

Cloud version limit

In the cloud version, a loop can run up to 1,000 times.

If the limit is exceeded:

  • The loop and all sub-loops stop with a false condition.
  • The error is recorded in the workflow log.
  • The workflow continues.
The limit applies to all loops and sub-loops together. For example, if a main loop runs 500 times and a sub-loop runs 600 times, the total is 1,100 iterations. In this case, all loops stop at the 1,000th iteration, even if the main loop has not finished.
Go to Bitrix24
Don't have an account? Create for free