Call Subprocess action
updated 2 months ago
Call subprocess action enables users to use existing processes within another process (parent process). When a parent process calls a subprocess (a child process), the child process executes in a sequential manner. Once it completes, the execution control is then transferred to the main parent process.
How to configure the Call Subprocess action?
Go to the Process Designers section and open a new or an existing process. Actions configuration can be performed once they are dragged and dropped on canvas.
Step 1: Drag the Call Subprocess action from Toolbar and drop it on canvas; click on the action to open the Properties Panel.
Step 2: You can edit the Action Name.
Step 3: Select Subprocess from a list of processes you have created.
Step 4: Click on "Subprocess configuration"
If the process (that is being call as a subprocess) has input and/or output process variables defined at process level, in the next step you must map the parent process variables to the child process variables (and/or vice-versa). This way, when the child process (subprocess) is executed, you ensure that data passes from the parent process to subprocess (as input) and back to the parent process (as output).
Step 5: Mapping input/output process variables
- Input variables:
you can map a subprocess output variables to parent process variable so that when the action is executed, data passes from the subprocess back to parent process.
press “+Add subprocess output” and the selector will open displaying the subprocess output variables (if the subprocess has any output process variables defined);
on the left side, map it to a parent process variable.
For more details please check the below example:
Possible use case: A small shop keeps daily files with products sold and they want to send email confirmations to their customers. Instead of manually writing and sending a personal email to each customer, one-time configuration of a process may help with automating this daily task. By simply running and uploading the daily file they have.
We have created 2 flows:
2. Send email - template for customers: includes a Send email action configured which will send out emails to customers. This way you will not need to configure from scratch an action (or an entire process) that you may re-use. Simply by calling it in a "Call subprocess" action. This is the child process. The child process will look like this:
To configure a Send email action you may check Send email action article.
The child process uses a process variable named inputdata. Inputdata is a data model with 4 attributes: to, subject, bodyDetails1, bodyDetails2.
These attributes used in the configuration of the Send Email action will receive data from the parent process at runtime.
1. Notify clients based on daily files: Gets data (related to customers and products they ordered) from the external .xls file and, for each entry in the file, will send confirmation emails to customers in the file, with details related to their order. Let's call this the parent process. The parent process will look like this:
To configure the Get File Data action you may check the Get File Data article.
Two process variables were created:
- GetProductData (type list of orderedproducts) that matches the structure of the excel file that will capture the data from the file at runtime.
- productList (type file; set as Input) that will fetch the file details at runtime
In Get File Data, configure the Configuration panel as follows:
Next, in order to ensure that a separate email is sent to every entry in the file, a ForEach action is needed. Check For Each article for configuration details.
Define the list and the iterator name:
Now let's configure the Call subprocess action:
Step1: Click on the action and the Properties Panel will open.
Step 2: Select a process you want to you within the main process. In our case, process that has the template for send email action configured.
Step 3: click on the Subprocess configuration card to move to next configuration steps.
Step 4: To ensure that data is passed from parent process (from the file) to child process, you need to perform the data mapping for input and/or output process variables.
In our case, the process has no output variable as the only output of the process will be actually sending out the emails to the customers.
Mapping the subprocess input variables to variables coming from the process is important to ensure there is data to initiate the subprocess run.
The elements that are used in the Send email configuration in the child process (To, Subject, bodyDetails1, bodyDetails2) will receive data from the file (customeremail, orderid, productordered, totalAmountInvoice|)
As our action is inside a foreach border, use the iterator's attributes when mapping the data, not the attributes of the data model that captures the data from the file.
Save, Validate and Run the Proces. Upload the .xls file and hit Run.
This is one sample of an email sent.