Libraries

There's no need to reinvent the wheel when you're developing a robotic process in Appian RPA. Developers can leverage existing code to integrate common operations into their robotic processes. These pieces of code are known as libraries and help you develop robotic processes more quickly and predictably.

This page describes libraries in the context of Appian RPA, including how and where libraries are used in a robotic process lifecycle. Throughout the Appian RPA documentation, you'll see libraries mentioned during development and within the RPA console.

What is a library?

A library is a set of code and classes to complete common tasks. Sometimes referred to as "nanobots," libraries are designed to be reusable in a robotic process or across multiple robotic processes. You can develop libraries for your specific use case or use libraries built by other developers. Think of libraries as building blocks to help you code a robotic process faster.

In the file system, libraries appear as .jar files.

Types of libraries

In Appian RPA, you'll work with workflow libraries often. You can develop custom workflow libraries to use in your robotic processes.

You'll also use code libraries, such as traditional Maven dependencies, in Appian RPA processes. You are probably familiar with these if you've done Java development before.

In Appian RPA, you'll use workflow libraries and code libraries for different purposes. Workflow libraries are useful when you have reusable Java functions that need to be shared across robotic processes. Instead of having duplicate code within your bots, you can define a workflow library and define actions within your robotic process workflow that reference that library. For example, if you have multiple robotic processes that need to get the same information out of your customer relationship management (CRM) system, that is a good candidate to be defined as a workflow library. Code libraries are used to help developers do the things they need to do in Java. An example of a code library is Log4j, which is a Maven Central library that can be used to help with Java logging.

Keep in mind that Appian RPA's bundled export feature only includes libraries and other artifacts that are kept in the Console's designated repository. If your robotic process references libraries elsewhere, you'll need to do some additional configuration when you import the robotic process to another environment.

Library versions

Like any piece of a big project, you'll need to edit or maintain library code from time to time. Maven requires artifacts to have certain metadata declared in the file when deployed to the repository. This metadata assists in better organization, dependency management, and version control. Maven uses this metadata with the pom.xml file to assemble and manage the pieces of your project. More on artifacts and metadata.

Each time you create or update a library, you'll need to push it to the console repository for the changes to appear in Appian RPA. Development practices may require you to update the version number to help track when major changes are introduced.

In Appian RPA, a library's version comprises three digits:

  • The first digit in the version number identifies the major version. This value is incremented for significant changes such as new methods or changed methods that impact backwards compatibility.
  • The second digit in the version number identifies the minor version. This value is incremented for changes such as code refactors that don't impact backwards compatibility.
  • The third digit in the version number identifies the hotfix. This value is incremented for small changes such as bug fixes.

When you share a robotic process to another Appian RPA environment, libraries are bundled to help streamline the process. When you import a workflow library or robotic process package, Appian RPA inspects the package on import to the new environment to determine if any of the libraries already exist.

More on deploying code

More on deploying robotic processes and apps

Manage Appian RPA workflow libraries

Manage workflow libraries within the Robotic Processes tab in the Appian RPA console. Here, you can see the list of existing workflow libraries, edit a workflow library, or add a workflow library. You can also import and export libraries to share them without using an IDE.

More on managing workflow libraries

Export a workflow library

You can export a workflow library from Appian RPA to share. The export feature packages the project along with all private dependencies, eliminating the need to use an IDE or Maven.

To export a workflow library:

  1. In the Appian RPA console, go to the Robotic Processes tab.
  2. Click Workflow libraries in the toolbar.

    rpa-toolbar-libraries.png

  3. In the List of workflow libraries, locate the library you want to export.
  4. Click Export library in that workflow library's Actions column.
  5. Appian RPA packages the library and downloads as a ZIP file. The package's file name is formatted as <groupId> - <artifactId> - <version>.zip to provide key version-control details.

Import a workflow library

Appian RPA lets you quickly and easily import a workflow library from the AppMarket or other sources, without needing to use an IDE or Maven.

To import a workflow library:

  1. In the Appian RPA console, go to the Robotic Processes tab.
  2. Click Workflow libraries in the toolbar.
  3. On the List of workflow libraries page, click Import Library in the toolbar.
  4. Click Upload to browse for the workflow library package on your computer, or drag and drop the file. The package must be a ZIP file.
  5. Click Import. Appian RPA begins to process the workflow library and add it to the console and local repository.

Your imported workflow library may overwrite an existing one under certain conditions. Specifically:

  • If you import a workflow library with a new major version (first number in the series), it will be imported separately from the existing workflow library. The new workflow library and the existing workflow library will both remain in Appian RPA. The status in the inspection window will say New major version.
  • If you import a workflow library with the same major version as one that already exists, the existing workflow library will be overwritten. Appian RPA will ask you to confirm this is what you want to do. Any robotic process that referenced the existing library will be updated to reference the newly imported workflow library. The status in the inspection window will say Changed.

See Versioning your workflow library for a description of how to increment your workflow library's version numbers to properly anticipate import behavior.

Using a workflow library in a robotic process

By now you know a library is a set of code used to achieve a smaller common task in your overall robotic process. After you identify or develop the library you want to use in your robotic process, it's time to set it up in the workflow.

  1. In the Appian RPA console, go to the robotic process configuration.
  2. Go to the Workflow area.
  3. Create an action or click an existing one.
  4. Click the libraries icon 2236298.png.
  5. Start typing the name of the library you want to associate with this action and select it from the suggestions.
  6. Click OK.

As you learn more about libraries, you might find it helpful to integrate logging to detect when issues occur in the execution of a robotic process. Add logging to your code to print informative messages in the execution log. You can then refer to the execution log if your robotic process doesn't execute successfully.

Create a workflow library in Appian RPA

If you're comfortable working with Java and want to create a set of reusable workflow libraries and custom methods, follow the steps in this section.

  1. Create a robotic process in the Appian RPA console. Choose the Blank template and take note of the default values in the Group and Version fields.
  2. The source code downloads to your computer. Add it to the directory where you can access it with your IDE.
  3. Within the src/main/java/com/appian/robot/core/template folder, open the .java file. You can also create a new one. If you create a new java file, delete the original one.
  4. Implement the INano interface and add the @Nano annotation to the class.
  5. For each custom method you create, use these annotations:
    • Use the @JidokaMethod annotation to create a method in your custom workflow library. The name and description you add here will be visible in the console when you associate the method with an action in the workflow. For example:

      1
      
        @JidokaMethod(name = "Set Cell Value", description = "Initializes Excel to Powerpoint workflow.")
      
    • Use the @JidokaNestedParameter annotation to create custom parameters which also appear in the console. For example:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      
        @JidokaNestedParameter(
                id = "firstDropdown",
                name = "First Dropdown",
                placeholderText = "Choose an option",
                type = EJidokaParameterType.ENUMERATOR,
                choiceValues = {"text box", "credential", "check box", "radio button"}
        ),
        @JidokaNestedParameter(
                id = "textbox1",
                name = "Text Value",
                placeholderText = "This box should be populated with 'text1`",
                rendition = {EJidokaParameterRendition.LABEL_DISPLAY_HIDDEN},
                groupId = "1",
                colWidth = 33,
                validate = "textbox1 == 'text1'",
                dependsOn = "firstDropdown == 'text box'",
                validateMsg = "Please enter 'text1'"
        ),
      
  6. When you're finished developing the methods in your custom workflow library, save and push the workflow library as you would a robotic process.

After you push the workflow library with the custom input, a user can configure the action using the inputs your specified in the code. The following screenshot shows the action configuration when the user select Text Box in the First Dropdown menu:

rpa-custom-input.png

The field labels use the name parameter, and the user sees the validateMsg when the input doesn't match what's expected.

Versioning your workflow library

If you update an existing workflow library, you'll want to increment some of its version numbers to indicate whether you made a major or minor change. This is a standard practice, as noted above. Follow these recommendations for versioning so the workflow library imports as expected when you share it with others:

  • If you are importing a workflow library which isn't backwards compatible, the major version must be incremented. This prevents existing versions of the same workflow library from being overwritten when the new workflow library is imported.
  • Keep previous versions of workflow libraries available. By having the earlier version available, your workflow library can be recovered if there's an issue importing a new version of it.

Add the workflow library in the console

Next, navigate to the console to configure the workflow library and prepare it for use in a robotic process:

  1. Go to the Robotic Processes page in the Appian RPA console.
  2. Click Workflow libraries in the toolbar.
  3. You'll see a list of workflow libraries available in the console. To add a new one, scroll down to the Workflow library editor.
  4. Click New to clear the form and add a new entry.
  5. Fill in the fields:
    1. Repository: Choose the repository where the workflow library exists.
    2. Group: Use the value you noted when you created the robotic process. This information is also stored in the pom.xml file.
    3. Artifact: Go to the robotic process's pom.xml file to locate this value.
    4. Version: Use the value you noted when you created the robotic process. This information is also stored in the pom.xml file.
    5. Main class: The name space and class of the workflow library you created. Once set, click the icon and Appian RPA shows a list of available classes to choose from. If you entered it incorrectly, it will show an error.
    6. Notes: Any additional information you want to appear with the workflow library.
  6. Click Save to save the new entry.

Now you're ready to use the workflow library and its methods in a robotic process.

Use a workflow library in a robotic process

  1. Go to the robotic process configuration page of a new or existing robotic process.
  2. In the Workflow, add a generic action.
  3. Click the action's list icon 951644.png.
  4. Navigate to Workflow libraries in the Actions menu.
  5. Your workflow library should appear in the list. Click it to see the available methods you created within the library.
  6. When you select a method, you'll see the name, description, and parameters you set appear in the configuration window. You may notice that the annotation for the parameters don't appear in the user interface. In this case, refer to your .java file to see the order of parameters in the method.
  7. Click OK to finish configuring the action.

And that's it! Your custom methods are also available to other robotic processes in the console. As you learn more about libraries, you might find it helpful to integrate logging to detect when issues occur in the execution of a robotic process. Add logging to your code to print informative messages in the execution log. You can then refer to the execution log if your robotic process doesn't execute successfully.

Create custom inputs

You can create custom inputs such as checkboxes, radio buttons, and drop-downs to be used with your workflow library when its associated with an action in the robotic process workflow. When you create and publish a workflow library with custom inputs, you make it easier for other developers as they configure a robotic process using low-code actions. These custom inputs are created via enum classes within the JidokaNestedParameters annotation. The optional elements vary by the type of input you create. A full list of optional elements is available in the Javadocs.

The EOptionsService modifier populates the input options using information from the Appian RPA console. For example, optionsService = EOptionsService.CREDENTIAL lists credential entries that have been added to the Appian RPA environment. You can use other module configurations as these enum constants, such as ATTRIBUTE_TO_RETURN, BROWSER_TYPE, and CONTROL_TYPE. See the Javadocs for a full list.

The following code shows examples of how to create custom input fields in your workflow library:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package com.appian.robot.core.template;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.novayre.jidoka.client.api.EJidokaParameterRendition;
import com.novayre.jidoka.client.api.EJidokaParameterType;
import com.novayre.jidoka.client.api.EOptionsService;
import com.novayre.jidoka.client.api.IJidokaServer;
import com.novayre.jidoka.client.api.INano;
import com.novayre.jidoka.client.api.JidokaFactory;
import com.novayre.jidoka.client.api.JidokaMethod;
import com.novayre.jidoka.client.api.JidokaNestedParameter;
import com.novayre.jidoka.client.api.JidokaParameter;
import com.novayre.jidoka.client.api.SDKParameterMap;
import com.novayre.jidoka.client.api.annotations.Nano;

@Nano
public class RobotBlankTemplate implements INano {

    @JidokaMethod(paths = {
            "sample-low-code-action"
        },
        name = "Sample Low-code Action",
        description = "A sample to show the capabilities of the low-code actions")
    public void sampleLowCodeAction(
        @JidokaParameter(
            name = "All Parameters",
            type = EJidokaParameterType.NESTED,
            nestedParameters = {
                @JidokaNestedParameter(
                    id = "firstDropdown",
                    name = "First Dropdown",
                    placeholderText = "Choose an option",
                    type = EJidokaParameterType.ENUMERATOR,
                    choiceValues = {
                        "text box",
                        "credential",
                        "check box",
                        "radio button"
                    }
                ),
                @JidokaNestedParameter(
                    id = "textbox1",
                    name = "Text Value",
                    placeholderText = "This box should be populated with 'text1`",
                    rendition = {
                        EJidokaParameterRendition.LABEL_DISPLAY_HIDDEN
                    },
                    groupId = "1",
                    colWidth = 33,
                    validate = "textbox1 == 'text1'",
                    dependsOn = "firstDropdown == 'text box'",
                    validateMsg = "Please enter 'text1'"
                ),
                @JidokaNestedParameter(
                    id = "textbox2",
                    name = "Text Value 2",
                    groupId = "1",
                    colWidth = 33,
                    dependsOn = "firstDropdown == 'text box'"
                ),
                @JidokaNestedParameter(
                    id = "textbox3",
                    name = "Text Value 3",
                    groupId = "1",
                    colWidth = 33,
                    dependsOn = "firstDropdown == 'text box'"
                ),
                @JidokaNestedParameter(
                    id = "checkbox",
                    name = "Check box items",
                    multiple = true,
                    rendition = {
                        EJidokaParameterRendition.OPTIONS_EXPAND_VERTICALLY
                    },
                    type = EJidokaParameterType.ENUMERATOR,
                    dependsOn = "firstDropdown == 'check box'",
                    choiceValues = {
                        "One",
                        "Two",
                        "Three"
                    }
                ),
                @JidokaNestedParameter(
                    id = "radiobutton",
                    name = "Radio Button Items",
                    rendition = {
                        EJidokaParameterRendition.OPTIONS_EXPAND_HORIZONTALLY
                    },
                    type = EJidokaParameterType.ENUMERATOR,
                    dependsOn = "firstDropdown == 'radio button'",
                    choiceValues = {
                        "A",
                        "B",
                        "C"
                    }
                ),
                @JidokaNestedParameter(
                    id = "credentialsDropdown",
                    name = "Credentials Dropdown",
                    placeholderText = "List of credentials",
                    type = EJidokaParameterType.ENUMERATOR,
                    dependsOn = "firstDropdown == 'credential'",
                    instructionalText = "Credentials available for this robot",
                    optionsService = EOptionsService.CREDENTIAL
                )
            }
        ) SDKParameterMap parameters) throws Exception {
        debug(parameters);
    }

    /**
     * Prints object's JSON representation.
     *
     * @param object
     */
    private void debug(Object object) {
        IJidokaServer < ? > server = (IJidokaServer < ? > ) JidokaFactory.getServer();
        String objectJson;
        try {
            objectJson = object == null ? "NULL" : new ObjectMapper().writeValueAsString(object);
        } catch (Exception e) {
            objectJson = "ERROR PROCESSING OBJECT TO JSON";
        }
        server.debug(String.format("CLASS: %s, JSON: %s", object == null ? "-" : object.getClass(), objectJson));
    }
}

This version of the Appian RPA documentation was written for Appian 21.4, and does not represent the interfaces or functionality of other Appian versions.
Open in Github Built: Fri, Oct 22, 2021 (11:11:24 AM)

On This Page

FEEDBACK