UiPath Best Design Practices

Robotic Process Automation (RPA) is one area that many are starting up or interested in learning aboutand understanding. With the growing demand, we build many automation solutions over time. But the question is, are we following the best practices?
From my experience, best practices are something that many tend to ignore. However, it is essential to follow the best practices when developing automation solutions to ensure,
  • High-quality delivery
  • Reliability of the solution
  • Better readability of the code
  • Efficient execution
  • Useful audit trails to audit and troubleshoot
  • Effective error handling
We, as developers, should follow a common framework of best practices within our organization. It is a responsibility of a solution architect to build and maintain a standard best practices guideline in an organization. However, we should know the basic and standard best practices for developing automation workflows.
Mentioned below are some of the quite common practices that we can introduce into our workflows.

Project Organization

Organizing the project is one key aspect of using best practices. Introduce the below-mentioned standards to manage your project.
  • Improve the reliability of the solution by building stable and robust workflows that can handle errors and recover 
  • Improve and maintain efficiency by cutting down development time through methods such as introducing concepts such as code reusability
  • Ensure maintainability of the code by introducing methods for the development team to collaborate quickly and update the project
  • Consider easy extendability when building a solution to incorporate new components.
Now let's see how we can achieve these by following the below mentioned best practices.
Naming Conventions
Naming conventions are essential to ensure easy understanding and readability of the code. A UiPath automation solution can consist of many workflow files, many activities, variables, arguments, and grouped containers. Let's take it one by one and understand how we can use proper naming conventions.
UiPath Solution
In an organization, you might have multiple automation solutions built to automate various processes. Hence, it is essential to have a descriptive name for the project when creating it. The solution name should explain what process or subprocess the solution address. Use a name that is not too long but adequately describes the process. For example, an automation solution built for the HR department to reconcile all employees' monthly attendance; could have the name "HR_ReconcileMonthlyAttendance."
Use the following when creating and using variables within the workflow.
  • Use meaningful names to create the variables. 
  • Do not use lengthy names.
  • Variables must always be named using the “ThisIsCamelCase” format.

Use the following when creating and using arguments within the automation solution.
  • Use meaning full names to create the arguments.
  • Include the argument direction as the prefix of the argument name. E.g.: (In_CustomerName, Out_InvoiceTotal)
  • Use the naming standard same as the variables.
Workflow files
Use the following guidelines when naming workflow files.
  • Use a short but meaningful name specifying the task the workflow is handling.
  • Use the same naming standard as variables and arguments.

    • It would be nice if the name can have a verb describing what the workflow does. (E.g.: ExtractingCustomerInformation)
Activities and Containers
A UiPath workflow file consists of multiple activities and containers. Use the following guidelines to rename them.
  • All activities should have a short meaningful name.
  • Avoid using default names, as it would be harder to trace them when troubleshooting.
  • If you want to have the activity's default name, use it along with a suffix that describes its action. (E.g., "Assign - Extract Customer Name"). The following workflow illustrates the activity renaming concept.
Workflow Design
A UiPath workflow file can be designed in different ways. However, it is essential to use the correct layout, depending on the activities performed in the workflow.
  • The main workflow of the solution works best as a Flowchart or a State Machine.

    • If your process consists of linear or iterative actions, use Sequence inside the Main workflow and join the Sequence containers. 
    • Suppose you are working with transactional data (data records that do not depend on one another) with different states. In that case, it is probably best to work with the Robotic Enterprise Framework (REFramework).

  • If the flow contains business logic, use a Flowchart.

    • Flowcharts provide the best visibility of the flow when handling business rules. Use of a Sequence would work; however, Sequence becomes complex when dealing with complex, multiple decisions.

  • Avoid using nested IF conditions as it makes the workflow hard to read. Suppose you are having more than two levels in the nested IF condition. In that case, either use a Flowchart or break the conditions into multiple conditional statements on the same level.
  • Avoid using nested Flowcharts as it makes the workflow hard to read and manage.
  • Use a Sequence when you are using UI Automation as the actions get executed sequentially.
  • Do not overload a workflow file with many actions; break it into multiple workflows.

    • Break the flow into subtasks/ subprocesses.
    • Use separate workflow files for subprocesses, and use Invoke Workflow activities to invoke them from a central control workflow when necessary.
Following the mentioned practices provide many benefits, such as:
  • Reusability of workflows
  • Ability to test each workflow individually
During the development phase of the project, many developers contribute to the automation solution. Additionally, the RPA Solution Architect reviews the code to ensure the following,
  • All business requirements are met and handled accurately.
  • Development best practices are addressed.
  • Supporting system audits
  • Ensure seamless onboarding of new members to the project
  • Ensure efficient execution and many more depending on the requirements
It is crucial to have the automation solution in a readable form for any technical or non-technical user to understand the code quickly. You can follow some of the methods described below.
  • Include annotations at the top of every workflow describing the purpose of the workflow. The annotations should include,

    • A description describing the task handled by the workflow
    • Input arguments and the expected data type
    • Output arguments and the expected data type
    • Pre-conditions describing the expected state before running the workflow
    • Post-conditions describing the expected state after running the workflow
The below image illustrates a sample workflow annotation.
  • Introduce Comments activity to explain the logic of the code where necessary. 
  • Introduce folders within the automation solution to hold related workflow files

    • For example, if you have workflow files that interact with an SAP application, have a folder created for SAP, and store all the workflows that interact with SAP inside the SAP folder. Use application name for the folder
    • Store the workflows that manipulate data under a folder named "Data Processing" or a folder that contains a similar name.
    • If you are using the REFramework, introduce the additional folders to organize the solution as required.
    • Store configuration files under the "Config" folder
The following screenshot shows a sample project with organized workflows.
  • Use annotations for variables and arguments describing their purpose and usage within the workflow. You can add annotations for variables through the variables panel and for arguments through the arguments panel.

Exception Handling and Logging

In UiPath categorizes the exceptions into two segments, such as Application Exceptions and Business Rule Exceptions. Let's take a look at the best practices to follow when handling both exception types.
Business Rule Exceptions
Business Exceptions are always related to processed data and the business logic. Hence, following the below-mentioned methods would give better readability better handling of business exceptions.
  • Use Flowcharts to handle Business Exceptions to improve readability.
  • Use Log Message activity and Throw activities to log the business rule exceptions with the correct code.

    New BusinessRuleException("Your Business Rule Exception Message") ;
Application Exceptions
Application Exceptions are always related to the applications that the robot interacts. There can be many reasons for the robot to throw an application exception, such as:
  • Application stopped responding
  • Internet connection is not available
  • Slow reloading speed of web pages and many more
There are many activities available in UiPath to handle application exceptions. Follow the below suggestions to handle better the exceptions based on the requirement.
  • Use Log Message activities with correct exception code to log the application exceptions.
  • Use Throw activity with Application Exception code to retry failed items. Use the following code in both Log Message and Throw activities to log application exceptions accurately.

    New ApplicationException("Your Application Exception Message")
  • Identify the workflows that may throw such errors and wrap them with Try-Catch activities. The following screenshot shows a sample Try-Catch activity configured to capture multiple exceptions and handle them accordingly.
  • Implement the Sequence activities that allow the robot to restart the process or retry the same failed activity in case of an error within the Try-Catch.
  • Use of Orchestrator Queues would automatically retry the transactions that failed with Application Error. If you do not use Queues, ensure you have a logic to auto-retry the failed transactions.

General Exception Handling Tips

You can apply the following tips to handle better the usual errors that we come across. These also apply to the application exceptions mentioned above.
  • Use proper logging levels in Log Message activities
  • Use of ReTry Scope activity to retry a particular set of activities based on the availability of a specific UI element.
  • Use of Global Exception Handler to retry failed activities where necessary. You can create the Global Exception Handler through the Project panel, as shown in the following screenshot.

Some General Tips

Lastly, the following are some common tips to follow when finalizing the development.
  • Do not use any hardcoded values for variables, unless it is specifically needed for the program to run.
  • Do not use hardcoded values for arguments.
  • Remove unused dependencies from the through the Dependency Manager.
  • Clean up all the unused variables from the solution using the Remove Unused Variables option.
  • Use the Workflow Analyzer to build your design rules and standards to address the above mentioned best practices. The Workflow Analyzer can be accessed from the Design ribbon in UiPath Studio. Workflow Analyzer consists of multiple rules which you can configure according to your best practices followed.


The use of best practices allows the teams to deliver a high-quality automation solution for the clients. Best practices not only ensure quality but also provide easy onboarding of new members. This article covers some of the commonly used best practices when developing automation solutions in UiPath. Thank you very much for your time, and I hope you found this article interesting. Please feel free to comment, share your thoughts, and share the topics you would like me to cover in future articles.

Similar Articles