The Appian Services module contains a number of methods that you can use in robotic processes to leverage Appian design objects. This page describes the module's architecture and methods it contains, as well as some examples of how to use the module.
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.
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.
Additionally, the module is built for ease of use between environments:
Unlike other Appian RPA modules, you don't need to include a Maven dependency in the pom.xml file. The Appian Services module is configured to use in robotic processes out of the box.
The Appian Services module contains a service class
IAppian to define and implement calls to Appian actions. It sends the message to the 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.
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. We've built two functions to help you implement those calls faster:
Use the uploadDocument function 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||Filename to use when upload is complete. If empty, the value will be taken from the
To retrieve a document from Appian, 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|
While the start process action can be called using a method in the Java code, using the start process action from the robotic process workflow is both easier and more robust. The user interface provides a low-code experience that allows you to search for and select available process models in Appian.
As you define the robotic process workflow, you associate actions with each step. This is how the robotic process knows what code to reference at each stage of the workflow. Within the module, the Start Process action lets you kick off a process in Appian as part of a robotic process.
The Start Process action lets you map variables from a process model in Appian to the robotic process variables you've defined in the configuration. The module 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 action:
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.
You can save all results to one variable in Appian RPA to pass it to Appian as structured data. Structured data will be passed from Appian RPA to Appian in JSON format.
To properly pass the parameter values to Appian, you'll need to format the data properly. Appian expects structured data values passed to process parameters in JSON format.
Before starting the process, all JSON values will be automatically converted to Appian values using the same transformation logic as a!fromJson. If you're passing structured data to Appian, follow the format used in the a!fromJson function.
After you've mapped process parameters to variables in the robotic process, you can add them to your Java method using the getWorkflowVariables helper in the server function. Use this to capture and use data at a later point in the process. Remember that structured data sent to Appian should use JSON format.
Here are some examples of how to use the
1 2 3 4 5 6 7 8 // 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