The Appian Services module extends robotic process automation capabilities within your Appian applications. Using the methods within the module, your process can automatically send data to or request data from Appian numerous times throughout the process execution. These actions occur without initiating an Appian process model, making communication faster and simpler.
This module contains the service class
IAppian to define and implement calls to Appian actions. It sends the message to the Appian RPA Console, which then communicates with Appian. Using the server as an intermediary for communication between the resource and Appian bolsters security by protecting passwords and other sensitive information from being exposed on the resource.
Additionally, the module is built for ease of use between environments:
To use the methods in this module, you can use the low-code module available in the Appian RPA Console or call the methods from your source code. The low-code module allows you to easily configure methods in a user interface and call robotic process variables to use as values or store returning method results. However, some methods, like the uploadDocument() and downloadDocument(), can only be called from the source code.
The following sections address how to use methods in the low-code module and other methods in the source code.
Using methods from a low-code module is both easier and more robust. The Appian Services low-code module allows you to configure the Start process method and the Evaluate expression method through a user interface.
The Start Process method lets you kick off a process in Appian as part of a robotic process. You can map variables from a process model in Appian to the robotic process variables you've defined in the configuration. The method passes data from Appian RPA variables to Appian using this map and initiates a process using the data as input.
To use the Start Process method:
Select a process model and the process parameters appear.
If you don't have access to the selected process model, you'll see a message saying it's not visible and you won't be able to load the process parameters.
Once you've mapped your process variables to the variables in your robotic process, you can reference those variables using other low-code modules in your workflow. This allows you to easily capture and use those values throughout your robotic process without going into your source code.
The Evaluate expression method allows you to write and evaluate regular expressions and Appian expressions directly in your robotic process. This method provides an expression pane where you can call Appian expression rules (
rule!) and constants (
cons!), reference robotic process variables (
pv!), and use Appian functions to format and aggregate your data.
This action is particularly helpful with conditional actions. With this method, you can create an
if statement that can determine which output the robotic process should follow. In a generic action, this method allows you to determine a variable's value using logic, allowing your data to be dynamic.
To use the Evaluate expression method:
It's common for a robotic process to iterate over many items. For example, you could process several employees, IDs, or bank accounts. To process numerous items, a robotic process workflow will include a loop.
Loops utilize conditional actions to determine when all available items have been processed, and which action to take next. Using the Evaluate expression method, it's now easier than ever to construct an
if statement in your conditional action to determine if there are anymore items to process.
The example below illustrates how to create a low-code loop in your workflow.
In the Robotic process configuration page, create a new process variable to provide the current index of the loop. In the initial value field, enter the first index number. In many cases, this will be 1.
Create a generic action and use the Evaluate expression method from the Appian Services module. Create an expression that will increment the index after each flow in the loop completes. The expression should save the output back into your index variable. In the example workflow above, this action would be
1 pv!currentIndex + 1
Create a conditional action and use the Evaluate expression method from the Appian Services module. Enter an expression to compare the current item's index to the length of the list of total items. In this example, we are comparing the current item index with the total number of contracts. There is no need to save the output back into a variable.
1 2 3 4 5 if( pv!currentIndex <= length(pv!contracts), true, false )
When the robotic process reaches this point of the workflow, it will continue looping through the actions as long as the current index is less than the number of contracts. When the index equals or exceeds the number of contracts, the conditional action routes the robotic process to another action or to end the execution.
You can call the Appian Services module from the robotic process code to perform actions such as querying data, calling a smart service, and calling a Web API in Appian. The Web API method includes helpers that make it simpler to perform common actions like upload or download a document from Appian.
Unlike other Appian RPA modules, you don't need to include a Maven dependency in the
pom.xml. The Appian Services module is configured to use in robotic processes out-of-the-box.
Use the IWebApiRequestBuilderFactory API class within the Appian Services module to call Web APIs in Appian.
The class references the environment's base URL in requests so you simply need to include the API endpoint instead of the full URL. You won't need to update the endpoint URL or Appian environment when deploying the robotic process elsewhere. However, if you update the endpoint in the Appian design object, remember to update the endpoint value here as well.
For security reasons, the API call originates from the RPA server, not the resource itself. This protects access tokens from being exposed during the request communication.
To get started, you'll first have to create the Web API object in your Appian application to properly receive and parse the data. You can configure the API response to return the data you're interested in. You can also set up the Web API to execute a smart service.
Find more details about the Web API class and associated functions in the Appian RPA Javadocs. In the console, click Help > Javadocs.
Two common uses for calling a Web API in Appian are to upload or download documents. There are two methods that can help you implement those calls faster:
Use the uploadDocument() method to upload a document in a robotic process:
IWebApiRequestBuilderFactory uploadDocument(endpoint, file, destFileName)
|endpoint||String||API object endpoint|
|file||File||File to upload. You can pass the file as an input stream from the file path so the Web API can reference the file wherever it is currently stored.|
|destFileName||String||File name to use when upload is complete. If empty, the value will be taken from the
Use downloadDocument() method to retrieve a document from Appian. To retrieve the correct document, include the document ID in the following function:
IWebApiRequestBuilderFactory downloadDocument(endpoint, documentId)
|endpoint||String||the API object endpoint|
|documentId||Integer||ID of the Appian document to retrieve|
Although it is recommended to call robotic process variables from the low-code modules in your workflow, you can also call them using the Java method getWorkflowVariables() in the server function. This method allows you to capture and use the variable in other points of the robotic process.
The code snippet below is an example of using the server.getWorkflowVariables() function:
1 2 3 4 5 6 7 8 9 // Gets the map of workflow variables containing those defined into the robot configuration page Map<String, IRobotVariable> variables = server.getWorkflowVariables(); // Gets the variable called "var1" IRobotVariable rv = variables.get("var1"); // Updates the value of var1 to the current value of item rv.setValue(item);
On This Page