Tip: Libraries are used in custom code development for Appian RPA.
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. This page also walks you through the steps to create a workflow library, add it to the RPA console, and use it in a robotic process.
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.
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.
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:
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 robotic tasks and apps
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.
On the Robotic processes tab, click the Workflow libraries icon:
On the Workflow libraries page, you can manage the libraries available for the robotic processes in the console.
Here you'll see a list of the workflow libraries defined within the console, along with actions you can perform. Appian RPA comes with a local Maven repository where you'll deploy code, including libraries. You can add a workflow library in Appian RPA using the Workflow library editor.
The list contains multiple columns:
Together, the Group, Artifact, and Version create the Maven coordinate for the library.
Use the Workflow library editor to add new workflow libraries within the console or edit existing ones. When you code a new workflow library, you'll need to add it to the List of workflow libraries. This is a necessary step before you can associate libraries with actions in the robotic process workflow.
To add a new workflow library:
To edit a workflow library:
To delete a workflow library:
You can export a workflow library from Appian RPA to share. This packages the project along with all private dependencies, eliminating the need to use an IDE or Maven.
To export a workflow library:
Click Workflow libraries in the toolbar.
<groupId> - <artifactId> - <version>.zip
to provide key version-control details.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:
Your imported workflow library may overwrite an existing one under certain conditions. Specifically:
See Versioning your workflow library for a description of how to increment your workflow library's version numbers to properly anticipate import behavior.
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.
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.INano
interface and add the @Nano
annotation to the class.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 robotic task. 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'"
),
After you push the workflow library with the custom input, a user can configure the action using the inputs your specified in the code.
You can create custom inputs such as checkboxes, radio buttons, variable pickers, and drop-downs to be used with your workflow library when its added as 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
127
128
129
130
131
132
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
),
@JidokaNestedParameter(
id = "variablePicker",
name = "Workflow Variable Picker",
type = EJidokaParameterType.VARIABLE_PICKER,
variablePickerType = "{http://www.appian.com/ae/types/2009}Text"
)
}
) 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));
}
}
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:
Next, navigate to the console to configure the workflow library and prepare it for use in a robotic process:
pom.xml
file.pom.xml
file to locate this value.pom.xml
file.Now you're ready to use the 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.
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 task. Add logging to your code to print informative messages in the execution log. You can then refer to the execution log if your robotic task doesn't execute successfully.
Libraries