Bitrix24Care

Activities: Flow Control

Wait for Event

The activity pauses a workflow execution and waits for a user to run an action.

We recommend using the User notification function before the command. Users will see that their action is required to proceed with the workflow execution.

The only activity parameter is The event can be sent by. Choose a circle of users who can execute this command.

Consider a short example of using this activity. Having performed the activity block, the workflow will stop and wait for the user to decide which branch the events will follow.

To execute a command,

  1. Go to Automation > Workflows.
  2. Find and open the created element.
  3. Open the Business Processes tab.
  4. Select a command next to Run Action.
  5. Click the Execute Commands button.

Condition

The structure permits you to direct a workflow to different branches depending on preset conditions.

There are different condition types:

Element Field. The activity branch of the condition will be executed if the parameters related to the element fields coincide.

Variable Value. The activity branch of the condition will be executed if the parameters related to workflow variables coincide. You can use the values of both variables and template parameters in this condition type.

Mixed. Set a condition for different sources using this activity branch. Thus, there is no need to create separate activity branches to check each condition. You can select variables, element fields, or constants and specify conditions for them.

True. The activity branch will be executed immediately, and the condition is always met. This condition type comes in handy if none of the other conditions are met.

The conditions are checked from left to right. It is recommended to make such a condition branch the right-most one.

PHP Code. The code is indicated as a condition.

This type is available in the Bitrix24 On-Premise version only.

The code in the condition must result in a logical expression (true or false). If the indicated PHP code returns the value true, the branch of activities below such a condition will be executed. If false is returned, the next condition will be checked.

Note:
  • Only a user with administrative rights can set a PHP code.
  • Only a PHP code can be used for this type of condition. The parameters of the type {=Variable:Variable2_printable} are not supported.

Modified Document Fields. If the workflow is autorun when changed, there is an option to check the field changes of the element. The activity branch will be executed if you enter some modifications in a field.

This type is available in the Bitrix24 On-Premise version only.

You can use this condition type only after additional configuration of the module. Find the instructions below.

How to set up the Modified Document Fields condition type (for developers)

To use this condition type, you need to apply the settings on the module side. When starting a workflow, it is required to pass an array of the modified fields using the parameter CBPDocument::PARAM_MODIFIED_DOCUMENT_FIELDS:

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 ); 

Also, you need to implement support for this condition type in a document to see it in the workflow editor:

 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

This structure allows you to direct a workflow to different branches depending on which event occurs earlier. In other words, the activity that occurs earlier in any branch will result in the execution of the chain below such an activity.

To choose an activity branch in this structure, use the Wait for Event or Pause Execution activity.

The Pause Execution activity permits you to resume a workflow at a certain time in case no command is executed. Otherwise, the workflow will just stop and wait for the execution of any command inside the structure.

Parallel Execution

This activity runs the simultaneous execution of multiple activity branches. If one of the activity branches is not executed in the Parallel Execution structure, the workflow will stop until its execution.

Set Status

The activity permits you to change the workflow status.

This activity is available only in status driven workflows.

Also, this activity has the Abort current status option. It immediately moves an element to the specified status without waiting for the completion of the previous one.

Iterator

This activity enumerates the values of multiple-value sources. You can create a cycle of activities that will be executed for each value, one by one.

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

After that, you can arrange the execution of the set of similar activities for all the selected values entered in the field or variable.

For example, you have a variable with the Link to Employee type, which contains a list of account users. You need to create a task for each of these users sequentially. To do it, select the variable in the iterator parameters and add the Create task activity to the construction.

To use each time the next value of the multiple-value variable in the cycle, insert the Value item from the Additional Results of Iterator.

While Loop

Do not use the 'Email message' activity when testing the loop.

If there is an error and the process repeats endlessly in the loop, the activity will be executed 1,000 times, and 1,000 emails will be sent from your account. There will be no way to stop the sending in this case.

Make sure that the While Loop structure works properly, then use it to send emails.

The structure executes its subactions as long as a given condition is met. In other words, the cycle works as long as the condition is valid (true), otherwise (false) the loop ends.

There are different condition types:

Element Field. The loop will continue operating as long as the parameters related to the element fields coincide.

Variable Value. The loop will continue operating as long as parameters related to the workflow variables coincide. You can use the values of both variables and template parameters in this type.

Mixed. Set a condition for different sources using this activity branch. Thus, there is no need to create separate activity branches to check each condition. You can select variables, element fields, or constants and specify conditions for them.

PHP Code. The code is indicated as a condition.

This type is available in the Bitrix24 On-Premise version only.

If the indicated PHP code returns the value true, the loop will continue operating. If false is returned, the loop will end.

Only a user with administrative rights can set the PHP code.

True. The loop will always be executed.

For Bitrix24 Cloud accounts, the loop will iterate up to 1,000 times.
Was this information helpful?
Integration specialist assistance
That's not what I'm looking for
Complicated and incomprehensible text
The information is outdated
It's too short. I need more information
I don't like the way this tool works
Go to Bitrix24
Don't have an account? Create for free
Related articles
Activities: CRM Activities: Element Processing My Activities in workflows Using Macros in Expressions Activities: Drive Activities: Other Activities: Tasks Workflow activities Activities: Interactive Settings