Appian Services 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.

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:

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

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 the Appian Services low-code module

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.

Start process

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:

  1. Go to the Appian RPA Console and open the Robotic Processes tab.
  2. Open a robotic process configuration and navigate to the Robotic process variable section.
  3. Create and save robotic process variables that will map to the variables in the process model you want to reference in a workflow action.
  4. On the Robotic process configuration page, navigate to an action in the workflow.
  5. Click the action and click the list icon 951644.png.
  6. From the Module tree, open the Appian Services module and click Start Process.
  7. In the Process Model field, search for the process model to reference. As you type, Appian RPA suggests available process models to choose from.
  8. 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.

  9. If your process variables use primitive data types, you can map them to robotic process variables.
  10. You can also save the overall process ID to a variable in the Save Process ID to menu.
  11. Click OK to save.

rpa-start-process-module.png

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.

Evaluate expression

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:

  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 951644.png.
  4. From the Module tree, open the Appian Services module and click Evaluate Expression.
  5. In the Edit Expression pane, enter a regular expression or Appian expression. As you type, the editor will suggestion functions and objects to reference in your expression.
  6. Use the Operator dropdown to store the result or append the result of the expression to a robotic process variable.
  7. In the Save Into field, enter the name of a robotic process variable.
  8. Click OK to save.

evaluate expression

Loop through a list

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.

rpa-looping-workflow.png

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

    rpa-looping-variables.png

  2. 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 Increment Index.

    1
    
     pv!currentIndex + 1
    
  3. 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.

Using the Appian Services Java module

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.

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. There are two methods that can help you implement those calls faster:

Upload document

Use the uploadDocument() method 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 File name to use when upload is complete. If empty, the value will be taken from the file parameter.

Download document

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)

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 parameterized variables in the Execute Robotic Process integration.

Accessing robotic process variables

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);

Open in Github

On This Page

FEEDBACK