Overview

Sections

How to create an RPA flow using Invoke Workflow to invoke a sub workflow

Beginner | 20 Minutes

RPA

Overview

In Robotic Process Automation (RPA), invoking a subflow from a main flow is a common way to organize tasks and reuse logic within processes. Subflows act as modular components that can be called within a main flow to perform specific tasks, making the automation workflow more organized and maintainable. For example, you can define the data validation or data entry part of the flow as a subflow to be invoked during the execution of the main flow.

In this tutorial, we will show you how to create a basic flow using the Invoke Workflow activity to invoke a subflow (part of a different .xaml file) in the project folder within the main flow. We will create a flow to pass the variable/argument from the main flow into the subflow and get the arguments back from the subflow to the main RPA flow.

📋 Requirements

  • Install the latest version of RPA Studio on your machine:
  • Download the connection files
  • Download RPA Installer from RPA Management.
  • For this tutorial, you need to install:
  • IDE Studio
  • Establish a connection between the RPA Studio and the RPA Management.
  • You can check the Infor RPA Studio User Guide for details.

Tutorial

1

Open RPA Studio

Open RPA Studio on your machine and sign in, if required.

2

Create a New Project

On the Home page of RPA Studio, click Create New Project and specify the following properties in the popup window:

  • Name: InvokeWorkflow
  • Project Location:
  • Description: Demonstrates how to invoke a subflow inside the main flow
  • Language: VB (selected by default)

3

Define Assign Activity

We will start the flow by adding the Assign activity to the canvas. You can find the list of activities by clicking Activities in the left-hand sidebar or from the View menu in the top bar. Use search to find the activity you want.

The Assign activity allows us to assign a value to a particular variable. Let's create a variable that can later be referenced in the activity properties. We will call the new variable input, and it will have the type string with no default value.

  • The To property contains the variable that we will assign the value to.
  • For the Value property, we will simply use the string "Hello".

4

Add a SubSequence

Create a new sequence in a different file. Click +New from the action ribbon and select Sequence.

A popup window will appear to specify the name of the sequence as SubSequence.xaml. Make sure to save it under the InvokeWorkflow folder and click Save. A new sequence file will be created and visible in the Project panel and will be open on the main design canvas.

Next, add the Assign activity to the canvas of the new SubSequence. We will first create arguments that can be referenced in the activity properties.

Note: Use variables for internal data within a workflow, and arguments to pass data to and from workflows or subflows. This separation ensures clear data handling and keeps workflows modular and reusable.

  • For the To property, create an argument called output of type string without a default value and direction OUT.
  • For Value, create an argument called inputargument of type string with direction IN.

Click the Assign activity and fill in the To and Value properties:

  • To: output
  • Value: inputargument + " World"

The names of the arguments specified in the subsequence should be remembered, as you will use them in the "main flow" (the one marked as Main in the Project panel). It is important to specify the direction for the arguments. IN arguments are those coming from MainPage.xaml, and OUT arguments are the ones output from SubSequence.xaml. Arguments from the subflows will not be visible in the RPA Management Process Details for configuration.

5

Add and Configure Invoke Workflow

Next, go back to the MainPage.xaml project and add an Invoke Workflow activity. Configure it as follows:

  • For the Workflow file property, which contains the actual file path of the SubSequence.xaml file, create a variable called filepath of type string with the default value of the file path (for example: C:\Users\nkostuch\AppData\Local\InforRPA\InvokeWorkflowExample\SubSequence.xaml).
  • Note: To get the subsequence file path, right-click on the SubSequence.xaml file in the Project panel and select Open containing folder. This will open the folder where the .xaml file is stored. Right-click on the SubSequence.xaml and select Properties, where you will find the full file location prefixed with /<filename and extension> (e.g., /Subsequence.xaml).
  • Ensure the file is saved within the open project, as only those files will be published when the project is published.
  • For the Input Argument, specify the VB expression for the dictionary of the values to be passed to the subsequence in the following way: New Dictionary(Of String, Object) From {{"inputargument", input}} inputargument is the argument from the SubSequence.xaml file, and input is the variable from the MainPage.xaml whose value will be passed to the subsequence and assigned to the inputargument argument in SubSequence.xaml.
  • For the Output Argument, which will hold the value of the argument passed from SubSequence.xaml, create a variable with the same name as the one in SubSequence.xaml, but with a different data type. Let's create another variable called output, with the variable type IDictionary(Of String, Object).

6

Add a Message Box

To verify if the values were passed between MainPage.xaml and SubSequence.xaml, add the Message Box activity. For the Input Text, specify the following VB expression to see the value of the output variable passed to the flow:

output("output").ToString

Note: output is a variable of type IDictionary, so it holds the dictionary of output values from the sub-sequence.

Save the flow and click Run to execute it.


Flow Improvement

To output multiple arguments from the subsequence, follow these steps:

Inside the SubSequence.xaml, add another Assign activity and configure it as follows:

  • For the To property, create the argument:
  • Name: Output2 of type string and direction Out.
  • For the Value property, assign a random string such as "extra value".

Next, go back to MainPage.xaml and update the Message Box activity. In the Input Text, specify the following expression to display all arguments passed from the subsequence:

output("output").ToString + " " + output("output2").ToString

This way, you can see all the arguments passed from the subsequence.

Was this section helpful?

What made this section unhelpful for you?

On this page
  • How to create an RPA flow using Invoke Workflow to invoke a sub workflow
View as Markdown

Ask an AI

Open in ChatGPTOpen in Claude