Call Subprocess
11min
the call subprocess action enables users to use existing processes inside another process (parent process) when a parent process calls a subprocess (a child process), it executes in a sequential manner once the child process 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 the subprocess from a list of processes from your account step 4 click on the subprocess configuration card to go to the next configuration steps 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 the parent's process variables is not mandatory 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) output variables you can map a subprocess output variable to the parent process variable so that when the action is executed, data passes from the subprocess back to the 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 typing and sending a personal email to each customer, a 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 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 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 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 to configure the get file data action you may check the get file data article two process variables were created getproducts (type list of orderedproducts ); data model that matches the structure of the excel file that will capture the data from the file at runtime productslist (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 select the list to iterate through, i e getproducts getproducts set the iterator name (you can name it iterator iterator or row or entry etc) 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, the process that has the template for sending email action we earlier configured step 3 click on the subprocess configuration card to move to the next configuration steps step 4 to ensure that data is passed from the parent process (from the file) to the 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 step 5 save , validate and run the process upload the xls file and click run this is one sample of an email sent