You are on page 1of 85

Processes and Libraries

 Creating a Basic Process


A step-by-step tutorial for creating a simple automation process leveraging UI elements.
 Creating a Basic Library
Learn to create, publish, and use a library in other automation projects.
 Working with Sequences
Learn to use sequences for linear automation processes.
 Creating a Flowchart
Follow this example to learn how to use multiple branching logical operators in flowcharts.
 Using State Machines
Use state machines with their transitions and a finite number of states in their execution.
 Loading Web Services in Libraries
Generate activities from SOAP or REST web services, or Postman collections.
 Using the Global Exception Handler
Learn how to determine the project’s behavior when encountering an execution error.
 Managing Dependencies
Add, update, remove and repair dependencies to your project.
 Test Activities and Create Test Benches
Learn to use the Test Activity feature, to create test benches, and to debug your workflow
from and to a certain activity.

Variables
 Using Text Variables
Follow this example and learn how to use text variables in automations.
 Using Boolean Variables
Find out how to use boolean variables in automations.
 Using Integer Variables
Follow this simple example on using integer variables in automations.
 Using Array Variables
Check out this example on how to use array variables in automations.
 Using Date and Time Variables
Learn how to use date and time variables in automations.
 Using Data Table Variables
Follow this example on how to use data table variables in automations.
 Using GenericValue Variables
Learn to use this proprietary type of variable.
 Using QueueItem Variables
Learn to use this proprietary type of variable in queues and transactions.
Automating UI Elements
 Automatic Recording with Basic and Desktop
Follow an example of how you can use the automatic recording.
 Automatic Recording with Web
Learn to use the web recording and understand how it works.
 Using Data Scraping
Check out this example on how to extract data using data scraping.
 Using Input Methods
Follow this tutorial on input actions for interacting directly with an opened application or
web page.
 Using Output or Screen Scraping Methods
Check out this example of how to use the several screen scraping methods and the practical
differences between them.
 Relative Scraping
Check out this tutorial on how to use relative scraping.
 Mouse and Keyboard Automation
Automate a process by using activities that simulate mouse and keyboard input.
 Using Text Automation
Automate a process by using text recognition activities.
 Using OCR and Image Automation
Learn how to use OCR and Image automation in your projects.
 Generating Tables from Unstructured Data
Learn how to generate tables from unstructured data and store the information in DataTable
variables.
 Generating a Selector with Wildcards in the Selector Editor Window
Learn how to generate selectors with wildcards.
 Using a Dynamic Selector
Learn to use a dynamic selector to identify a target element based on the value of a variable
or argument.
 Using Fuzzy Search
Use the selector’s fuzzy search capabilities to locate strings based on a pattern.
 Using Non-Greedy Search
Learn to identify the target element from a pool of similar applications using non-greedy
search capabilities.
 Using RegEx Search
Use RegEx search in selectors to identify multiple target elements with a single search
execution.

Control Flow
 Using the Delay Activity
Learn to use this activity that enables you to pause the automation for a custom period of
time.
 Using a Do While Activity
Check out an example of the activity that can be used to step through all the elements of an
array.
 Using an If Activity
Follow an example of the activity that contains a statement and two conditions.
 Using a Switch Activity
Learn to use this activity that enables you to select one choice out of multiple, based on the
value of a specified expression.
 Using a While Activity
Check out an example on the While activity that enables you to execute a specific process
repeatedly, while a specific condition is met.
 Using a For Each Activity
Learn to use this activity for stepping through arrays, lists, data tables or other types of
collections.
 Using a Break Activity
Check out an example of this activity that enables you to stop the loop at a chosen point,
and then continues with the next activity.

Source Control
 Working with Git
Learn to authenticate to GIT, clone a repository, commit and push to GIT, create and manage
branches, and more.
 Set up and Work with TFS
Follow the steps to set up TFS, open and add a project, edit and checking changes to your
TFS repository.
 Working with SVN
Learn to open and add a project to SVN, edit and check changes to your SVN repository.

Technologies
 Example of RDP Automation
Follow this example of a process executing through a Remote Desktop Protocol (RDP).
 Example of Automating a Citrix App
Check out this process showcasing how automating Citrix technologies works.
 Example of Using the ScaleCoordinates Tool
Learn to use the ScaleCoordinates Tool to have your projects run on any DPI.
Developer
 Building Custom Workflow Analyzer Rules
Check out the samples and learn to build and integrate your own Workflow Analyzer rules.
 Building Activities Project Settings
Learn to build and integrate project-level settings for your own custom activities.
 Creating Custom Wizards
Create custom wizards and integrate them into Studio through custom activities packages.
 Governance
Use this sample to enforce a governance model at the organization level.

Creating a Basic Process


This tutorial teaches you how to create a basic process in Studio in 10 minutes and run it on your
machine. The example opens a browser, loads a certain web page, scrapes information, and writes it
to the Output panel, and in a Notepad file.

Let’s begin.

1. Launch Studio. In the HOME Backstage view, click Process to create a new project. The New
Blank Process window is displayed.
2. In the New Blank Process window:
o Enter a name for the new project and a description that summaries what you are
aiming to do with this automation project.
Note: The project name cannot exceed 128 characters, and the description cannot
exceed 500 characters.
o Select the location where to create the project.
o Select Windows - Legacy for the Compatibility option and VB for Language.
3. Click Create. The new project is opened in Studio.
4. Open Internet Explorer and navigate to https://www.uipath.com/product/studio. You can use
any supported browser, but make sure the required UiPath extension is installed.
5. In the Activities panel, search for Use Application/Browser and drag it to
the Designer panel. Notice that the activity is automatically added inside a Sequence.
6. In Use Application/Browser, click Indicate application to automate, and then move the
mouse pointer to the browser page you just opened. When the window is highlighted, click
anywhere in the browser page.
The Use Application/Browser activity is updated, the URL is added to the Browser URL field,
and a screenshot of the window appears inside the activity.
7. From the Activities panel, add a Get Text activity to the Do container of the Use
Application/Browser activity. Click Indicate in IE, and click on the text that you want to
scrape from the previously loaded web page.
8. In the Variables panel, create a new string variable called GetText, and set its scope
to Sequence. The purpose of this variable is to store the scraped information.

9. In the Get Text activity, insert the GetText variable in the Save to field.


10. From the Activities panel, drag a Write Line activity. In the input text field, add the
previously created variable. This activity writes the scraped data to the Output panel.
11. Add another Use Application/Browser activity to the project. Open a Notepad instance,
click Indicate application to automate, and then move the mouse pointer to the Notepad
window you just opened. When the window is highlighted, click anywhere inside it.
The Use Application/Browser activity is updated, the path is added to the Application
path field, and a screenshot of the window appears inside the activity.
12. Add a Type Into activity in the Use Application/Browser activity’s Do container.
Click Indicate in App to select the Notepad window, and add the GetText variable to
the Type this field. This activity writes the scraped text to a Notepad window.
13. In the ribbon, click Run File or use the Ctrl + F6 shortcut to execute the project.

When the execution is completed, notice that the scraped text is written to the Output panel, and in
the Notepad file.

Similarly, you can create other processes to scrape data from web pages, using the Table
Extraction wizard.

Creating a Basic Library


The following tutorial walks you through the steps of creating a library in Studio, publishing and
using it in other automation projects.

Creating a library is similar to Creating a Basic Process. The difference is packages are for creating
reusable components to be used in the context of other projects.

This example gets data from an Excel spreadsheet and appends it to another Excel file. Next, it walks
you through the steps for packaging and publishing the project to a custom feed, installing the
package to another project, and using the activity it contains.

This example uses Excel activities that do not require Microsoft Excel to be installed on your
machine.

Let’s begin.

Creating a Library

1. Launch Studio. In the HOME Backstage view, click Library to create a new library project.
The New Blank Library window is displayed.
2. In the New Blank Library window:
o Enter a name for the new project and a description that summaries what you are
aiming to do with this automation. For this example, you can use the
name QuickLibrary.
Note: The project name cannot exceed 128 characters, and the description cannot
exceed 500 characters.
o Select the location where to create the project.
o Select Windows - Legacy for the Compatibility option and VB for Language.
3. Click Create. The new library is opened in Studio.

Adding Excel Activities

1. In the Activities panel, search for the Read Range activity under System > File > Workbook,
and drop it to the Designer panel.
o In the Workbook path field, add the path to the Excel file from which you want to
get the data.
o In the Sheet Name field, add the name of the spreadsheet. For this example, the
name remains the default Sheet1.
o In the Range field, add the range of cells to be read. For this example, leave the field
empty so that all cells are read.
2. In the Properties panel of the Read Range activity, click the field next to DataTable, then
use the Ctrl + K keyboard shortcut to open the variable field, and add the name GetRange.
The type DataTable variable stores data from the read cells.
3. In the Activities panel, search for the Append Range activity under System > File >
Workbook. Add it below the Read Range activity.
o In the Workbook path, add the path to the file where you want to append the
copied data.
o In the Sheet name, add the name of the sheet. For this example, leave the
default Sheet.
o In the Data table field, add the previously created variable GetRange which stores the
information. Your project should look like in the image below.
4. In the ribbon, click Run File or use Ctrl + F6 to execute the workflow. The data gathered
from the first Excel spreadsheet is appended to another. It does not replace data that already
exists in the second spreadsheet.

Packaging a Library
To add this library as a reusable component to other automation projects, you need to package it as
a .nupkg file by publishing the project.

1. Open the library project in Studio.


2. From the ribbon, click the Publish button. The Publish Library window opens.
o In the Package properties tab, enter a package name. In the Release Notes field,
add a few details about the library. This is useful for tracking the changes made to
the library in each new published version.
o In the Publish options tab, select Publish to > Custom, and then, in the Custom
URL field, add the path to a local folder. For example, you can create a myfeed folder
on your Desktop.
3. Click Publish. The package is now available in the local folder as a .nupkg file.
Installing Reusable Components
To use the package in another project, you first need to add it as a project dependency. To get
started, create a new Process in Studio, as explained in the Creating a Basic Process page.

Read more about project dependencies in the About Dependencies page.

Adding a Custom Feed

1. In the Studio ribbon, click Manage Packages > Settings. The default and user-defined feeds
are displayed.
2. In the User defined packages sources container, add a name for your feed in
the Name field. In the Source field, add the path to the folder where you published your
library to.
3. Click Add. Your new feed is added to the section.
You need to follow the above steps whenever you want to add or remove a user-defined feed in
Studio. Check out the About Activities Packages to read more information about activities feeds.

Installing the Package

1. In the Manage Packages window, go to the previously added feed under the All


Packages tab on the left. The list of packages available on the feed is displayed.
2. Search for the package and select it. In our example, the package name is QuickLibrary.
3. Click Install, then Save. The package is now installed in your project, and visible in
the Project panel, under Dependencies.

Adding Activities from the Library

1. In the Activities panel, search for the name of the package, in our case Quick Library.
2. Drop the activity in the Designer panel.
3. In the Studio ribbon, click Run File or use Ctrl + F6 to execute the activity.
You can add other activities like Copy Sheet or Auto Fill Range, but these require Microsoft Excel to
be installed on your machine.

The advantage of reusable components is that they reduce repetition. You create them once and
reuse them in other projects.

Sequences
Sequences are the smallest type of project. They are suitable to linear processes as they enable you
to go from one activity to another seamlessly, and act as a single block activity.

One of the key features of sequences is that they can be reused time and again, as a standalone
automation or as part of a state machine or flowchart.

For example, you can create a sequence to take information from a .pdf file and add it to a
spreadsheet, and reuse it in a different setting, while changing just a few properties.
Please take into consideration that whenever you wish to copy a large number of activities from one
sequence to another, it is recommended to scroll down to the bottom of the Designer panel
beforehand. This is due to a Windows Workflow Foundation limitation.
📘
Note:
Sequences do not use connectors.

Example of a Sequence
To create a sequence that asks the user for his first and last name, and his hair color, and then
displays his answers, do the following:

1. Create a blank process and, on the Design tab, in the File group, select New > Sequence.


The New Sequence window is displayed.

📘
Note:
You can also add a Sequence activity to the Designer panel to create a new sequence, or simply
drag an activity from the Activities panel and Studio automatically adds a parent sequence to it.

2. In the Name field type a name for the automation, such as "First Sequence", and leave the
default project location or add a subfolder. Click Create. The Designer panel is updated
accordingly.
3. Create three String variables such as FirstName, LastName, and HairColor, so that you can
store data from the user in them. Leave the Default field empty, to indicate that there is no
default value.

4. Drag three Input Dialog activities to the Designer panel, one under the other.


5. Select the first Input Dialog and, in the Properties panel, add a Label asking for the first
name of the user, and a custom Title.
6. In the Result field add the FirstName variable. This indicates that this variable is going to be
updated with the value added by the user at this point.
7. Repeat steps 6 - 7 for the second and third Input Dialog activities to ask the user for his last
name and hair color, and store them in the LastName and HairColor variables.
8. Add a Message Box activity under the third Input Dialog.
9. Select the Message Box and, in the Properties panel, in the Text field, add the variables and
a string to enable you to display all information gathered from the user, such as:
FirstName + " " + LastName + " has " + HairColor + " hair."

📘
Note:
Remember to add spaces between variables and within strings for an optimal output.
The final project should look as in the following screenshot.
10. On the Design tab, in the File group, click Run. The automation is executed. The final output
message should look as in the following screenshot.
Flowcharts
Flowcharts can be used in a variety of settings, from large jobs to small projects that you can reuse in
other projects.

The most important aspect of flowcharts is that, unlike sequences, they present multiple branching
logical operators, that enable you to create complex business processes and connect activities in
multiple ways.

Flowcharts come with the Auto Arrange option in the context menu.

Example of a Flowchart
To exemplify the properties of a flowchart, we are going to build a guessing game that generates a
random number from 1 to 999 that the user must guess. To create such an automation, do the
following:

1. Create a blank process and from the Design tab, in the File group, select New > Flowchart.
The New Flowchart window is displayed.

📘
Note:
You can also add a Flowchart activity to the Designer panel to create a new flowchart project.

2. In the Name field type a name for the automation, such as "First Flowchart", and leave the
default project location or add a subfolder. Click Create. The Designer panel is updated
accordingly.
3. Create two Int32 variables (RandomNumber, GuessNumber) and a String one (Message).
4. Set the default value of the Message variable to "Guess a number from 1 to 999."
The RandomNumber stores a random number between 1 and 999, GuessNumber stores the user’s
guess and Message stores the message that is going to be displayed to prompt the user.
5. Add an Assign activity to the Designer panel, and connect it to the Start node.
6. In the Properties panel, in the To field add the RandomNumber variable.
7. In the Value field, type new Random().Next(1,999).

📘
Note:
This field uses the Random() function to generate a random number between 1 and 999. For more
information on variables, see Variables.

8. Add an Input Dialog activity to the Designer panel and connect it to the Assign one.


9. In the Properties panel, in the Label field, add the Message variable.
10. In the Result field, add the GuessNumber variable. This activity asks and stores the user’s
guesses in the GuessNumber variable.
11. Add a Flow Decision activity and connect it to the Input Dialog. This activity enables you to
tell the user if he correctly guessed the number or not.
12. In the Properties panel, in the Condition field, type GuessNumber = RandomNumber. This enables
you to verify if the number added by the user is the same as the randomly-generated one.
13. Add a Message Box activity and connect it to the True branch of the Flow Decision.
14. In the Properties panel, in the Text field, type "Congratulations! You guessed correctly! The
number was " + RandomNumber.ToString + ".". This is the message that is going to be displayed if
the user correctly guessed the number.
15. Add a new Flow Decision activity and connect it to the False branch of the previously
added Flow Decision.
16. In the Properties panel, in the Condition field, type GuessNumber > RandomNumber. This activity
enables you to check if the number the user added is bigger than the randomly-generated
one.
17. In the DisplayName field, type Comparison. This enables you to easily to tell the difference
between the two Flow Decisions used.
18. Add an Assign activity and connect it to the True branch of the Comparison activity.
19. In the To field, type the Message variable, and in the Value field, type a message indicating
that the guess was too high, such as "Too big. Try again.".
20. Select the Assign activity and press Ctrl+C. The entire activity and its properties are copied to
the Clipboard.
21. Press Ctrl + V. A duplicate of the previous Assign activity is displayed.
22. Connect it to the False branch of the Comparison activity and, in the Properties panel, in
the Value field, type "Too small. Try again.".
23. Connect the Assign activities created at steps 18-22 to the Input Dialog. A loop is created,
asking the user to type a smaller or bigger number, until he guesses correctly.
The final project should look as in the screenshot below.

State Machines
A state machine is a type of automation that uses a finite number of states in its execution. It can go
into a state when it is triggered by an activity, and it exits that state when another activity is
triggered.

Another important aspect of state machines are transitions, as they also enable you to add
conditions based on which to jump from one state to another. These are represented by arrows or
branches between states.

There are two activities that are specific to state machines, namely State and Final State, found
under Workflow > State Machine.

📘
Note:
You can only create one initial state, yet it is possible to have more than one Final State.
The State activity contains three sections, Entry, Exit and Transition(s), while the Final State only
contains one section, Entry. Both of these activities can be expanded by double-clicking them, to
view more information and edit them.

The Entry and Exit sections enable you to add entry and exit triggers for the selected state, while
the Transition(s) section displays all the transitions linked to the selected state.
Transitions are expanded when you double-click them, just like the State activity. They contain three
sections, Trigger, Condition and Action, that enable you to add a trigger for the next state, or add a
condition under which an activity or sequence is to be executed.
Example of How to Use a State Machine
To exemplify how to use a state machine, we are going to build the guessing game we did in the
previous chapter, the only difference being that we will try to guess a number between 1 and 100.

1. Create a blank process and, on the Design tab, in the File group, select New > State


Machine. The New State Machine window is displayed.

📘
Note:
You can also add a State Machine activity to the Designer panel to create a new state machine
automation.

2. In the Name field type a name for the automation, such as "First State Machine", and leave
the default project location or add a subfolder. Click Create. The Designer panel is updated
accordingly.
3. Create two integer variables, InitialGuess and RandomNumber. The first variable stores your
guess, while the second stores the random number.
4. Add a State activity to the Designer panel and connect it to the Start node. This is the initial
state, and it is used to generate a random number.
5. Double-click the activity. This State activity is displayed expanded in the Designer panel.
6. In the Properties panel, in the DisplayName field, type Initializing Random Number. This
enables you to easily tell states apart.
7. In the Entry section, add an Assign activity.
8. In the To field, add the RandomNumber variable.
9. In the Value field, type new Random().Next(1,100). This expression generates a random
number.
10. Return to the main project view and add a new State activity.
11. Connect it to the previously added activity.
12. Double-click the last added State activity. This activity is displayed expanded in
the Designer panel.
13. In the Properties panel, in the DisplayName field, type Guess Number. This state is used to
prompt the user to guess a number.
14. In the Entry section, add an Input Dialog activity.
15. Select the Input Dialog, and in the Properties panel, add an appropriate Label and Title to
prompt the user to guess a number between 1 and 100.
16. In the Result field, add the InitialGuess variable. This variable stores the user’s guess.
17. Return to the main project view and create a transition that points from the Guess Number
state to itself.
18. Double-click the transition. The transition is displayed expanded in the Designer panel.
19. In the Properties panel, in the DisplayName field, type Try Smaller. This message is
displayed on the arrow, enabling you to run through your automation easier.
20. In the Condition section, type InitialGuess > RandomNumber. This verifies if the user’s guess
is bigger than the random number.
21. In the Action section, add a Message Box activity.
22. In the Text field, type something similar to "Your guess is too big. Try a smaller number."
This message is displayed when the user’s guess is bigger than the random number.
23. Return to the main project view and create a new transition that points from the Guess
Number state to itself.
24. Double-click the transition. The transition is displayed expanded in the Designer panel.
25. In the Properties panel, in the DisplayName field, type "Try Bigger". This message is
displayed on the arrow, enabling you to run through your automation easier.
26. In the Condition section, type InitialGuess < RandomNumber. This verifies if the guess is
smaller than the random number.
27. In the Action section, add a Message Box activity.
28. In the Text field, type something similar to "Your guess is too small. Try a bigger number."
This message is displayed when the users guess is smaller than the random number.
29. Return to main project view and add a Final State activity to the Designer panel.
30. Connect a transition from the Guess Number activity to the Final State.
31. In the Properties panel, in the DisplayName field, type "Correct Guess".
32. In the Condition field, type InitialGuess = RandomNumber. This is the condition on which
this automation steps to the final state and end.
33. Double-click the Final State activity. It is displayed expanded in the Designer panel.
34. In the Entry section, add a Message Box activity.
35. In the Text field, type something similar to "Congratulations. You guessed correctly! The
number was " + RandomNumber.ToString + "." This is the final message that is to be
displayed, when the user correctly guesses the number.
The final project should look as in the following screenshot.
36. Press F5. The automation is executed correctly.
Loading Web Services in Libraries
Studio can generate activities directly from SOAP or REST web services, or Postman collections
through the Service Editor window.

SOAP and REST Web Services


The window enables you to automatically load all the methods or endpoints in a given web service,
be it REST or SOAP, as long as the provided link includes the services' definition - Swagger or WSDL.

Once loaded you select from which endpoints or methods to automatically create activities. All
selected items are displayed in the Activities panel, under the Namespace you provided in
the Service Editor window.

It is possible to then package these libraries as a .nupkg file and publish it to Orchestrator or to a


custom location. As a result, you can easily share your newly-defined activity with other developers
that you work with.
Adding Services
Follow the steps below to generate activities from web services:

1. Create a library in Studio, as explained in the About Libraries page.


2. In the Design tab, click New Service, or right-click Services in the Project panel, then
click New Service. The Service Editor window is displayed.
3. Add a file path or link to the Swagger or WSDL resource. Click Load. All defined endpoints
from the web service are now loaded in the Service Editor window.
4. Type in the method or operation you need in the Search Operations search box and view
the results below. For Swagger, methods are marked with different colors in each endpoint.
Use the Deselect All checkbox to deselects all endpoints and choose the endpoints that you
want to load. The namespace is generated automatically, simply type in a new name to
change it.
5. Click Save. The service is now integrated in the project tree.
6. To use the generated activities in the Designer panel, go to the Activities panel, search by
the service namespace in the Available activities section and drag each activity to the panel.

📘
Note:
For SOAP services, it is recommended to load only SOAP clients, as opposed
to HttpGet or HttpPost clients.
For Swagger services, when the service cannot deserialize the response from the server, it is
recommended to inspect the Swagger schema and search for required properties in the model
definitions.
To edit a service simply right-click the service in the Project panel, under Services and select Edit
Service.
Please note that if your project is under source control, checking out only the
library's project.json file enables the Edit Services option for .xaml files with loaded SOAP or REST
web services.
Adding and editing a service is also reflected in the project.json file containing the definition of the
library, and in the service document. A webServices node is added in the project.json file, and
each service is identified by the following elements:

Parameter Description

namespace The name of the service provided in the Service Editor window.

The path to the .json file containing metadata for the SOAP or Swagger service. The file is used
serviceDocument
when the service is repaired, and should be versioned as part of the project.

The file path or link to the Swagger or SOAP resource (provided when the service is created in
webDocumentUri
the Service Editor window).

uniqueReference A reference needed for versioning the service.

Repairing Services
dll files generated from SOAP or REST web services are not pushed to source control repositories.
Therefore, when checking out libraries that contain services, the projects have unresolved activities in
the Designer panel.
To repair those activities and regenerate the service .dll file right-click on the service node in
the Project panel and select Repair Service from the context menu.
SOAP or REST service metadata and additional information is stored in a .json file for each service
loaded in Studio. If a loaded service is missing its associated .json file, the Repair Services context
menu option for the Services node enables you to generate the missing .json files using the link to
the web document descriptor that was provided when that service was created. As a consequence,
filters that might have been applied when the service was first generated are not applied anymore
and all the resources provided by the aforementioned path or link are imported.
Publishing libraries using UiPath.Studio.CommandLine.exe command-line user interface detailed in
the Mass Update Command Line Parameters page does not take web services into consideration.
📘
Note:
Generated activities from SOAP or REST services cannot be localized in Studio.
To call activities generated from web services multiple times inside a loop, create a separate
workflow from the main library file, and invoke the service method there. In the main workflow, use
the Invoke Workflow File activity inside a For Each activity, and invoke the previously created
workflow.
For more details about generated activities from web services, check out this page.

Importing Namespaces
Studio v2020.4 brings a breaking change in terms of libraries with imported Swagger services. The
way in which Studio interprets the .json files from Swagger services has changed, thus generating
backward compatibility issues if and only if an existing service is edited from the Edit
Service window.
In the following example, we've illustrated the change using the Petstore demo web service.

Prior to Studio v2020.4, after adding the service to a library project, and using “Browse for Types…”
context menu, the following namespaces are found under SwaggerPetstore assembly name:

Drilling down in UiPath.WebClient._ClientNamespace the following types can be found:


Therefore, if AddPet activity had been used in a xaml file from a Studio library, it would have been
part of the UiPath.WebClient._ClientNamespace. The _ClientAddPetRequest type was used for
generating a request, like in the excerpt below:
xaml excerpt
xmlns:uw_="clr-namespace:UiPath.WebClient._ClientNamespace;assembly=SwaggerPetstore"
...
<uw_:AddPetActivity BearerToken="{x:Null}" ClientCertificate="{x:Null}"
ClientCertificatePassword="{x:Null}" Headers="{x:Null}" OAuth2Token="{x:Null}"
Password="{x:Null}" Username="{x:Null}" DisplayName="AddPet"
Endpoint="[&quot;https://petstore.swagger.io/v2&quot;]"
sap:VirtualizedContainerService.HintSize="200,22.4"
sap2010:WorkflowViewState.IdRef="AddPetActivity_1" TimeoutMS="30000">
<uw_:AddPetActivity.Request>
<uw_:_ClientAddPetRequest Body="{x:Null}" />
</uw_:AddPetActivity.Request>
</uw_:AddPetActivity>
</Sequence>
</Activity>
Using Studio v2020.4, the following namespace can be found when importing the same web service:
The following types are found when expanding the UiPath.WebClient.PetClientNamespace:
Therefore, if AddPet activity is used in a xaml file from a Studio library created with v2020.4, it is part
of the UiPath.WebClient.PetClientNamespace, and the PetClientAddPetRequest type is used for
generating a request. These are different namespaces and types as for libraries created with versions
prior to v2020.4.
Below is an excerpt of such a library created with v2020.4:
xaml excerpt
xmlns:uwp="clr-namespace:UiPath.WebClient.PetClientNamespace;assembly=SwaggerPetstore"
...
<uwp:AddPetActivity BearerToken="{x:Null}" ClientCertificate="{x:Null}"
ClientCertificatePassword="{x:Null}" Headers="{x:Null}" OAuth2Token="{x:Null}"
Password="{x:Null}" Username="{x:Null}" DisplayName="AddPet"
Endpoint="[&quot;https://petstore.swagger.io/v2&quot;]"
sap:VirtualizedContainerService.HintSize="200,22.4"
sap2010:WorkflowViewState.IdRef="AddPetActivity_1" TimeoutMS="30000">
<uwp:AddPetActivity.Request>
<uwp:PetClientAddPetRequest Body="{x:Null}" />
</uwp:AddPetActivity.Request>
</uwp:AddPetActivity>
</Sequence>
</Activity>

Postman Collections
The Postman application can be used for creating and grouping API definitions into collections, thus
organizing and chaining your requests together. Postman supports scripts for passing data between
API requests. Check out the Postman online documentation to learn about creating a collection.

If you already have a Postman collection, you can load its requests in Studio, and generate an
activity. Maintenance of the collection is done in Postman, and any changes are exerted in your
workflow as well.

Studio receives access to a Postman collection through its API key, which must be added to
the Service Editor window, in the File or Link field. Therefore, modifications to requests are done
only in Postman and not in Studio as well.

Studio loads all requests defined in the collection, and requests cannot be executed individually.
Editing and repairing a collection in Studio is done in the same way as for SOAP or REST web
services.

Prerequisites for Postman Collections

 Nodejs and NodeJS CLI, version 6


 Newman version 4.5.5

It is recommended to restart your machine after installing Newman.

Example with a Postman Collection


The following example uses a Postman collection to get the value of a certain currency and displays
it in Studio's Output panel.
In this example, we wrote a test scrip to iterate through the received data. We declared a global
variable directly in the script, but this can also be done with the Set a global variable snippet in
Postman, read more about this here.
The In argument passed the currency EUR value to an Out argument, visible in the library, in
the Properties panel > Input > Collection. The Out argument is visible in the same panel, in
the Output section.
Out arguments from the activities are mapped to a variable and its value is written to
the Output panel.

You can use an If activity to validate the variable's returned value. In this example, we validated that
the value is returned, and then wrote it to the Output panel.
Global Exception Handler
The Global Exception Handler is a type of workflow designed to determine the project’s behavior
when encountering an execution error. Only one Global Exception Handler can be set per
automation project.

📘
Note:
The Global Exception Handler is not available for library projects, only processes.
The Global Exception Handler has two arguments, that should not be removed.

The first argument is errorInfo with the In direction and it stores information about the error that
was thrown and the workflow that failed. The level of the error to be logged can be set in the Log
Message activity.
📘
Note:
Use the ActivityInfo property for errorInfo to get the name of the activity which threw the
exception and view it in the Output panel.
The second argument, result has the Out direction and it is used for determining the next behavior
of the process when it encounters an error. The following values can be assigned to
the result argument:

 Continue - The exception is re-thrown.


 Ignore - The exception is ignored, and the execution continues from the next activity.
 Retry - The activity which threw the exception is retried. Use the RetryCount method
for errorInfo to count the number of times the activity is retried.
 Abort - The execution stops after running the current Global Exception Handler.

📘
Note:
Any workflow may be flagged as a Global Exception Handler in Studio, except for library projects.
To control the workflow’s behavior in case of an error, the Global Exception Handler retries the
activity three times and then aborts with an error message.

Handling Errors During Debugging


When an exception is detected during debugging, the activity which faulted is highlighted, the
execution is paused, and the exception's type and details are mentioned in the Locals and Call
Stack panels.

Debugging actions like Continue, Stop, Retry, Ignore, Restart and Slow Step are available in the


ribbon. Ignore is used for continuing the execution from the next activity.
The Retry button retries to execute the current activity, without the Global Exception Handler
stepping in. The Continue action runs the Global Exception Handler, taking into consideration the
previously chosen values for the result argument, either Continue, Ignore, Retry or Abort.
📘
Note:
When using the Global Exception Handler with a project that includes a Try Catch, make sure to
group activities into a Sequence inside the Try container. Otherwise, the Global Exception
Handler does not execute.

In the case of nested activities, the Global Exception Handler executes for each activity in the call
stack. However, it does not execute for activities directly encapsulated in a Try Catch, unless they're
contained in an activity.

Example of Using the Global Exception


Handler
The following example showcases the project’s behavior when an exception is thrown during
execution.

The automation project is set to type some text in a Notepad file and then close the application, but
not before saving the file.

Creating the Workflow

1. Create a Blank Process by following the steps in the Creating a Basic Process page.


2. Open Notepad and save a document on your machine. You can name the file 1.txt.
3. In the Activities panel, search for Use Application/Browser and drag it to the Designer panel.
4. In Use Application/Browser:
o Click Indicate application to automate, and then move the mouse pointer to the
Notepad window. When the window is highlighted, click anywhere inside it.
The Use Application/Browser activity is updated, the path is added to
the Application path field, and a screenshot of the window appears inside the
activity.
o In the Properties panel, select the Always option for the Close property. This
ensures Notepad is closed after the automation runs.
5. Add a Type Into activity in the Use Application/Browser activity’s Do container.
Click Indicate in App to select the Notepad window, and add enter a text between quotation
marks in the Type this field. This activity writes the text into Notepad.
6. From the Activities panel, add a Keyboard Shortcuts activity to the workflow. Indicate the
Notepad window, then select Record shortcut and press Ctrl + S to record the key
combination that saves the file after the text was typed in.
The resulted workflow should look like this:
Adding a Global Exception Handler

1. In the Design tab part of the Ribbon, select New > Global Handler. The New Global


Handler window opens. Type in a Name for the handler and save it in the project path.
Click Create, a Global Exception Handler is added to the automation project.
2. Go back to the workflow you created earlier and modify it so that an activity fails to execute.
For example, in the Use Application/Browser activity, select the Match exact title option and
make sure the file is closed before you click Run File in the ribbon.

When the Global Exception Handler encounters an exception, it logs the name of the activity which
faulted and starts retrying the activity three times. If it encounters the same exception each time and
the number of retries reaches 3, the execution is aborted at the level of the activity which threw the
exception.

If during one of the retries an exception isn’t encountered, the execution of the workflow continues
and the Global Exception Handler doesn’t step in.

Managing Dependencies
Project dependencies in Studio refer to packages linked into a specific project, containing activities,
either default or custom. Dependencies are contextual and take into consideration each project's
definition, including the activities that it uses, variables, input/output arguments. Therefore, a
dependency is set only if it has at least one reference in the project's definition.

All project templates available in Studio come with their own default dependencies packages.

In StudioX, all projects come with the following default


packages: UiPath.System.Activities, UiPath.ComplexScenarios.Activities, UiPath.Excel.Acti
vities, UiPath.Mail.Activities, UiPath.Presentations.Activities,UiPath.UIAutomation.Activ
ities, and UiPath.Word.Activities.
If more need to be added, click on the Manage Packages button and install them. Installed
dependencies are available only for the current project, and the list of dependencies per project is
visible in the project.json file.
The Project panel displays the activities packages installed in the automation project, together with
their sub dependencies, runtime rules, requested, and resolved versions. The project compatibility is
displayed in the Dependencies node.
Hover over a dependency to view requested and resolved versions. Contextual actions
like Manage, Repair or Remove Dependency are available only for dependencies and not their
subpackages. Unresolved dependencies are marked with grey in the tree, not found dependencies
with red, while resolved and exact match dependencies with faded and strong blue.

Adding and Updating Dependencies


Whenever new versions are available for the current project dependencies, the Manage
Packages button from the ribbon gets an update icon  .

1. To manage dependencies in a project, simply right-click on the Dependencies category in


the Project panel, and then click on Manage. This opens the Manage Packages window,
with the Project Dependencies category. The   icon shows which packages are
currently installed.
2. Default dependencies are displayed, together with the versions that are currently linked to
the project. To update a package, simply click on the update icon  , next to the
available version number. The   icon is shown next to the package, meaning that
dependencies are ready to be installed.
3. Dependencies are installed in the project only after you click Save. Simultaneously, the
versions of dependencies are updated in the project.json file belonging to the project.
To add dependencies to a project, simply search and install them as you would any activity package.
Please note that the available packages differ depend on the project compatibility. For more
information, check the Manage Packages page.

Removing Dependencies

 To remove a project dependency, right-click the dependency in the Project panel, and then


select Remove Dependency. The dependency is removed from the Project panel
and project.json file.
Alternatively, you can go to Manage Packages > Project Dependencies, select the
dependency to remove, and then click Uninstall.
 To remove all unused dependencies in the project, select Remove
Unused > Dependencies in the Studio ribbon, or use the Ctrl + Shift + R keyboard
shortcut. All the installed packages that have no references in the current project are
removed from the Project panel and project.json file.

Repairing Dependencies
If a workflow opened in Studio has references to packages with versions that aren’t available in
current Studio feeds, said dependencies are marked as broken in the Project panel and details are
made available in the Output panel.

Studio allows for all dependencies to be repaired in bulk or individually. To repair all broken
dependencies, right-click on the Dependency node in the Project panel, and click on Repair
Dependencies.

Right-click on a broken dependency and select Resolve Dependency to repair it individually.


Alternatively, you can select Manage to open the Manage Packages window and update packages.

NuGet resolves broken dependencies by applying the Lowest Applicable Version   runtime


rule, meaning that it searches for the first applicable package version, higher than the one previously
set.
📘
Note:
Missing or invalid activities are marked in the Designer panel, while an error banner provides
additional information regarding the workflow and its unresolved dependency conflicts.
Setting Dependency Rules
Activity packages are available in multiple versions, which is why upon installing or updating them
using the Manage Packages, you can set dependency runtime rules for each of them.
The Runtime Rule specifies which package version to install at runtime. It features two available
options.

The Strict runtime rule is the default state for dependencies added upon process creation, and for
activities packages installed from the Manage Packages window. It means that only the specified
version of the package is used at runtime to execute the parent process. The Strict rule is marked in
the Project panel, under Dependencies by the   sign next to the package version.
The Lowest Applicable Version runtime rule means that if the target package isn’t found, the next
higher version is searched in order to resolve dependencies. The Lowest Applicable Version rule is
marked in the Project panel, under Dependencies by the   sign next to the package version.
When executing an automation project from Studio, the Robot downloads the specified or indicated
package version it needs to execute the project, in accordance to the previously set runtime rules for
each project. If the dependency used during execution has a Strict runtime rule and the exact
package version was not found, an error is thrown. For more information on setting runtime rules for
project dependencies check the Managing Dependencies page.

Resolving Dependency Conflicts


The installation of activities packages takes into consideration dependency runtime rules previously
set for said packages, but some conflicts between versions might occur when automating the
projects. Both the automation project and the library it contains might have the same activities
package, but with different versions and runtime rules. At design time, NuGet resolves such conflicts
by choosing the top level dependency, which is the closest to the project in the hierarchy.

The resolution of conflicts that might occur is explained below:


The project contains an activities package with version 1.0. The library is referenced to the project
and uses the same pack, but with a higher version. The top-level dependency v1.0 is used at runtime.
A warning is given, mentioning that a downgrade was detected.

The resolution of this scenario is applicable regardless of the runtime rule (Strict   or Lowest
Applicable Version  ) previously set for the activities packages.

 If you choose Yes, the activities package referenced in the project is upgraded to the version
used in the library.
 If you choose No, the Manage Packages window is opened with the Project
Dependencies window.
The project contains an activities package with the version 2.0. The library uses the same pack, but
with a lower version and the Strict   runtime rule. The top level dependency used in this case is
v2.0 and a warning is given when the package is installed in the project.
The project contains an activities package with the version 2.0. The library uses the same pack, but
with a lower version and the Lowest Applicable Version   runtime rule. The top level
dependency used in this case is v2.0 and a warning is given when the package is installed in the
project.
The project references a library with an activities package version 1.0 and Strict   runtime rule.
The project references another library, but with an activities package version 2.0. The top level
dependency in this case is the pack with v2.0, since it has the highest version. A warning is given
when the activities package is installed.
In this conflict the project references two libraries, which in turn have Strict   dependencies
referenced among them. This scenario isn't supported. For detailed information, check
the Dependency Resolution page.

Dependency cycles are types of conflicts that occur when a package references itself. If you name
your project UiPath, Studio detects a dependency conflict. This happens because
the UiPath package already exists and is a dependency to UiPath.UIAutomation.Activities. It is
recommended to avoid naming your project with the name of an already existing package that you
intend to add as a dependency.
The same dependency cycle occurs if you open a .xaml file from a folder named UiPath or any name
of an existing package that you intend to add as a dependency, and there is no project.json in that
folder. When you open a .xaml file that doesn’t have an associated project.json file, Studio creates
one and the "name" tag is populated with the name of the parent folder.

Opening Projects Created with Previous


Versions
🚧
Important!
Opening projects created with Studio v2016.2 directly in v2020.4 or higher versions is not supported.
First, open these projects with Studio v2018.4 and then with v2020.4 or higher.
When opening a project with or without dependencies, designed with a version prior to v2018.3
(except for v2016.2), Studio asks you if an automatic migration shall be performed, so that it may
attempt to retrieve missing dependencies or add default ones.

Upon confirmation, Studio attempts to retrieve missing dependencies and sets the Strict   
runtime rule for the packages that it finds. When using the Repair Dependency option in
the Project panel, Studio attempts to install the next best package version. If the package version is
not found, alerts are shown in the Output panel and you should check the configured feeds in
the Manage Packages window.
Processes containing dependencies and that were built with Studio versions prior to v2018.3
continue to execute with Robot v2018.3. The runtime rule for such projects is set to Lowest
Applicable Version  .
Projects created with versions prior to v2018.3 that were never published don't have dependencies
listed in the project.json file. When opening such projects, an alert in the Output panel notifies
you of missing dependencies. UiPath packages delivered locally with Studio are added as
dependencies with the Strict   runtime rule. The latest version of such packages is automatically
set.
If such projects contain packages other than those delivered with Studio locally, we recommend:

 Publishing the project using the Studio version in which it was created, thus aiding the
migration process by adding dependencies in the project.json file;
 Manually installing the missing package from the Manage Packages window, after setting
up the required feed;
 Using the Project Dependencies Mass Update tool to add the missing dependency to a
bulk of projects.

📘
Note:
Workflows containing invalid activities cannot be saved. Install the needed dependency and then
save the project.
Activities
packages UiPath.V7.Activities, UiPath.Platform.Activities, UiPath.Framework.Activities ha
ve been deprecated. Upon opening projects
with UiPath.Platform.Activities and UiPath.Framework.Activities packages, Studio v2018.3 or
above attempts to perform an automatic migration to replace the old versions of activities with new
ones.
📘
Important!
Workflows containing activities part of UiPath.V7.Activities package cannot be migrated.
A workaround is available for some cases in which the migration isn't automatically performed.

1. Open the project.json file with Notepad++.


2. Remove the "schemaVersion": "3.2" parameter.
3. Replace "studioVersion" with "toolVersion".
4. Change the "toolVersion" value from "18.3.xxx" to a previous version. For example,
change the value from "18.3.0.958" to "18.2.958". Save the file.
5. Open the .xaml file with Studio v2018.3 or above for the migration to be performed. The
deprecated activities packages are replaced with new ones, as illustrated in
the Dependencies section of the Project panel.

📘
Important!
In some cases, .xaml files containing the
packages UiPath.Platform.Activities and UiPath.Framework.Activities cannot be
automatically migrated and the workaround isn't applicable. For these situations, it is
recommended to open the projects in Studio v2018.2 or lower, and replace the activities belonging
to the aforementioned packages with activities contained in the UiPath.Core.Activities package.
The same can be done for workflows containing activities from UiPath.V7.Activities package.
Starting with Studio v2018.4.1, Microsoft.Activities v.1.0.1
and Microsoft.Activities.Extensions v2.0.6.9 are no longer packaged in
the UiPathStudio.msi installer.
In case repairing is needed when migrating projects containing these packs as dependencies, install
the two packages from the Official feed or a local feed. Before executing such projects created with
versions prior to v2018.4.1, make sure that the aforementioned packages are available in a feed
accessible by the Robot.
If you upgrade from a version prior to v2018.4.1, the two activities packages remain on
the Local feed.

Test Activities
Test Activity
The Test Activity context menu option part of the Designer panel is used for running a test on the
currently selected activity. When clicked, the Locals panel opens displaying the variables and
arguments in scope.

Test Activity can be used in two ways:

 add default values to properties and test


 add arguments and/or properties to activity properties and use the Local panel to add values
after clicking the Test Activity option.

Double-click the value field of a variable or argument, or click the   icon in the Locals panel,
and add a new value. Next, click Step Into to focus and execute the activity, and monitor the variable
or argument's value in the Locals panel.
The same is available when clicking Continue, but the values are not visible in the Locals panel.

Please take into consideration that dynamic checks when variables depend on other variables that
are defined later are not supported.

Execution logs generated by the Test Activity action are visible in the Output panel. Exceptions in


Studio can be bubbled up, which means that the exception may be passed to parent containers in
case it may be handled by them.

The Test Activity option is not available during debugging.

Example of Using Test Activity


For the If Activity example, we created a process that asks the user for two numbers, checks to see if
one is divisible by the other, and depending on the result, displays a different message in
the Output panel.

To check the behavior of the If activity defined in the process, use the Test Activity option, as
illustrated below:
The Test Activity action places the activity in the debugger and asks you for values to variables.
Once provided, click the Continue button for the debugging process to continue. In this particular
case, a message was written in the Output panel with the correct answer, which means that the
expressions written in the If activity were correct.

Create Test Bench


The Create Test Bench option allows for the creation of automation building blocks, which can then
be tested and added to the final workflow.

It is used for testing activities, working with variables and debugging the process. All this is done in a
test bench workflow, a temporary sequence that’s not part of the current project and that is
discarded when closed.

The Create Test Bench option is similar to the Test Activity option, with the exception that the
latter is contained and defined in an actual workflow.

To use the Create Test Bench option, go to the Activities panel search bar or use Ctrl + Alt +


F keyboard shortcut. Type the name of an activity and right-click to open the context menu.

Select Create Test Bench and the activity is automatically added to a sequence file not included in
your project. From there you can add other activities, change their default properties and debug the
process. The Output panel displays any logs or errors found during the debugging.

To save the file to your project, simply use the ribbon option Save as, add a file name and save it to
the same file path as your project.

Please note that Create Test Bench does not work with Pick Branch activity.

Run to this Activity


The Run to this Activity option is available when right-clicking an activity in the Designer panel.

This option starts the debugging process and pauses before the selected activity is executed while
highlighting it in the panel. If Run to this Activity is triggered when debugging is already paused,
the execution continues until the activity is reached.

Run from this Activity


The Run from this Activity context menu option enters debugging in a pause state, allowing you to
make changes to the values of variables and arguments from the Locals panel. Press Continue to
start debugging or use actions such as Step Into, Step Over, Step Out.

📘
Note:
An error occurs if you use Run from this Activity for an activity added inside one of the following
container activities: Try Catch, Switch, Parallel, Pick, Trigger Scope, or Retry Scope.

You might also like