Actions determine the options at the Work portal which can be launched and executed by a stakeholder whenever these make sense (Bizagi is context-aware), as described at Actions.
When configuring actions which either start a process or execute an expression, you may choose to define that these behave as Batch actions.
Batch actions in Bizagi, will group several data records into a single case (or single run expression), and end up executing something upon them simultaneously in a single instance.
Batch action examples
Common examples for batch actions would be:
•Triggering a marketing campaign for multiple customers in order to send them a common e-mail newsletter or promotion.
•While referring to the example on how a Hospital's Emergency Room operates, we could configure that for patients who recently went through the Hospital discharge process, providing them with a link to a customer satisfaction survey.
•If a doctor has an emergency we could create a batch action to reschedule all afternoon appointments.
Batch actions are very powerful because they allows to model and design an action while considering multiple records of data and giving them a unified treatment.
Consider the following regarding batch actions:
1. Adequate data model design
While designing a batch action, it is very important that your data model is compliant to it.
This means explicitly using a many-to-many relationship in your data model, between the process entity and the entity in which the action executes (applies when the action starts a process).
For batch actions that execute an expression, you do not need the above or any other special consideration, mainly because the grouped records you will be able to access and manipulate by means of a temporary data structure called EntityArray.
2. Grouping concept
Notice that batch actions will always group data in a new single instance (e.g one new process, or one new expression).
In case you wish to instead launch an action a multiple number of times, one per each individual record selected, then you may already do so through the grouping options in the Work portal without designing a batch action.
This works automatically for actions that start a process or execute an expression as well, because Bizagi will display common non-batch actions which apply to all those records selected:
Defining batch actions
In order to specify that an action should be a batch type, simply mark the Group several items into a single one checkbox in the Advanced configuration of actions in step number 2.
When defining a batch action which executes an expression, note that in that expression you will be able to handle all records by using an array of objects which is called EntityArray.
This means that for this array, you may obtain information as shown below:
for (var i = 0 ; i < EntityArray.length ; i ++)
For more information about such configuration, refer to Advanced configuration.
It is important to note that when using batch actions that Launch a process you SHOULD NOT connect the Process entity to the collection entity directly using a one-to-many relationship. If you do, every new case that groups records will replace their information in a previous case.
The correct way of relating the Process entity and the collection is using a many-to-many relationship.