19min

Call Subprocess action

The 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.

Document image

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 the Subprocess from a list of processes from your account.

Document image

Step 4. Click on the Subprocess configuration card to go to the next configurations steps.

Document image

If the process (that is being called 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 the subprocess (as input) and back to the parent process (as output).

Step 5. Mapping input/output process variables

Mapping all subprocess inputs and/or outputs to parent's process variables is not mandatory.

  1. Input variables
    • you can map a parent process variable to subprocess input variables so that when the action is executed, data passes from the parent process to the subprocess.
    • press +Add subprocess input and the selector will open displaying the subprocess input variables (if the subprocess has any input variables defined); 
    • on the left side, map it to a process variable coming from the parent process or give a default value (as applicable).
  2. Output 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.

Document image

We have created 2 flows for our example.

Create the subprocess

1. 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:

Document image

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.

Document image

These attributes used in the configuration of the Send Email action will receive data from the parent process at runtime.

Create the main process

2. 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:

Document image

To configure the Get File Data action you may check the Get File Data article. 

Two process variables were created:

Document image
  • <%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:

Document image

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:

Document image
Document image

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.

Document image

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.

Document image

Step 5Save, Validate and Run the Process. Upload the .xls file and click Run. 

This is one sample of an email sent.

Document image



Updated 27 Apr 2022
Did this page help?
Yes
No