Appian Services Module

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.

Using the module in robotic processes

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:

  • It automatically references the environment's base URL so there's no need to hard-code it in the robotic process or update it when deploying to Production.
  • Authentication is simpler and more secure by eliminating the need to use environmental variables and credentials. Appian actions are executed in the context of the user who starts the robotic process. In most cases, the robotic process initiator is actually the service account that already authenticates Appian and Appian RPA. The Appian Services module relies on this authentication mechanism when executing robotic processes, eliminating the need for additional credentials to be defined in the Appian RPA Console or referenced in the robotic process code.

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.

Module architecture

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.

Methods

Call a Web API

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. We've built two functions to help you implement those calls faster:

Upload document

Use the uploadDocument function to upload a document in a robotic process:

IWebApiRequestBuilderFactory uploadDocument(endpoint, file, destFileName)

Parameter Type Description
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 file parameter.

Download document

To retrieve a document from Appian, include the document ID in the following function:

IWebApiRequestBuilderFactory downloadDocument(endpoint, documentId)

Parameter Type Description
endpoint String the API object endpoint
documentId Integer ID of the Appian document to retrieve

Because the document ID is stored in Appian, you might find it easier to push this information to the robotic process by including instructions in the Execute Robotic Process integration.

Start process

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.

Add the start process action in the Console

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:

  1. Go to the Appian RPA Console and open the Robotic Processes tab.
  2. Open a robotic process configuration and navigate to an action in the workflow.
  3. Click the action and click the list icon to associate a method or module.
  4. In the list, click the plus sign next to Appian Services under Modules to expand the options.
  5. Click Start Process.
  6. In the Process Model field, search for the process model to reference in this action. As you type, Appian RPA suggests available process models to choose from.
  7. 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.

  8. For each process parameter, you can map it to a robotic process variable you've defined in the configuration. See Data format for more information.
  9. You can also save the overall process ID to a variable in the Save Process ID to menu.
  10. Click OK to save.

rpa-start-process-module.png

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.

Data 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.

getWorkflowVariables

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 server.getWorkflowVariables() function:

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);
Open in Github

On This Page

FEEDBACK