Usage
To use the RPA Framework integration, either the RPA Framework Task in BPMN or in CMMN must be used.
For the task itself, it's required to configure the RPA Framework task name
which must match the name within the "Tasks" section in the .robot
file.
Flowable .robot API
The Flowable RPA Framework module provides a small library to get input and write outputs back to the process. To use the library, the library must be imported:
*** Settings ***
Library flowable.rpaframework_client.API
Once imported, the methods are available to be used
Registering a task
To register a task, the typical .robot
file syntax can be used:
*** Tasks ***
My task name
task command 1
task command 2
....
The name of the task, in this example My task name
must match the RPA Framework task name
configured in the RPA Framework Task.
The executor will automatically pick up the task with the correct name and execute it.
Getting variables from the job
To retrieve variables, a variable can be assigned to flw input
:
${myVar}= flw input myJobVar
While ${myVar}
describes the variable used within the robot file, the myJobVar
is the variable coming from the process or case as specified in the input mapping.
Writing output variables
Once a value is computed, it can be written back to the job with flw output
:
flw output myJobResult ${myVar}
While ${myVar}
describes the variable used within the robot file, the myJobResult
is the variable which will be written to the process or case based on the output mapping of the rpa framework task.
Robot Files Syntax
A full documentation about the .robot
files syntax can be found at the RPA Framework documentation.
Example .robot files
Simple Example
A simple example which is multiplying the length of a string with a number is the following:
*** Settings ***
Library flowable.rpaframework_client.API
*** Tasks ***
Get weather forecast
${city}= flw input city
${days}= flw input days
${length}= Get Length ${city}
${temperature}= Evaluate ${days} * ${length}
flw output temperature ${temperature}
This example could do also something different and fetch the actual weather information. Just for simplification this example is doing simple computation to show the Flowable interface.
The first two lines include the Flowable library. Next, the task with the name "Get weather forecast" is created. In the two lines with "flw input" two variables are read from the rpa framework task. In the next two lines, it is doing the calculation, those two lines can be easily replaced with actually fetching/calculating the forecast. The last line sets the output back to the rpa framework tasks. Once the last line is reached, the execution will end and the process will continue.
Interacting with the screen
The following example is a bit more complex and interacting with the screen.
*** Settings ***
Library RPA.Tasks
Library RPA.Desktop
Library flowable.rpaframework_client.API
*** Tasks ***
Discounted cash flow
${fc1}= flw input fc1
${fc2}= flw input fc2
${fc3}= flw input fc3
${wacc}= flw input wacc
Open Application open -a /Applications/Microsoft\ Excel.app
Click image:images/fc1.png click
Press keys right
Type text ${fc1}
Press keys enter
Type text ${fc2}
Press keys enter
Type text ${fc3}
Press keys enter
Type text ${wacc}
Press keys enter
${terminal_region}= Find element image:images/terminal-value.png
${moved_t_region}= Move Region ${terminal_region} 205 0
${terminal_value}= Read Text ${moved_t_region}
${company_region}= Find element image:images/company-value.png
${moved_c_region}= Move Region ${company_region} 205 0
${company_value}= Read Text ${moved_c_region}
Take screenshot
flw output companyValue ${company_value}
flw output terminalValue ${terminal_value}
In this example, for input values are read, followed by opening an application. After that, the Excel application is opened (here for Mac, this line will look different for Windows). In the next line it's clicking on an element based on a locator from an image. This is followed by some keyboard navigation and using the values from before. Finally, it's going ahead and reading some values from the screen based on image locators and a relative offset. In the last step, after taking a screenshot, the result is written back to the process or case. For a full guide on using this file, go to the example.