- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- Control Flow
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- Logging
- The Diagnostic Tool
- Workflow Analyzer
- About Workflow Analyzer
- ST-NMG-001 - Variables Naming Convention
- ST-NMG-002 - Arguments Naming Convention
- ST-NMG-004 - Display Name Duplication
- ST-NMG-005 - Variable Overrides Variable
- ST-NMG-006 - Variable Overrides Argument
- ST-NMG-008 - Variable Length Exceeded
- ST-NMG-009 - Prefix Datatable Variables
- ST-NMG-011 - Prefix Datatable Arguments
- ST-NMG-012 - Argument Default Values
- ST-NMG-016 - Argument Length Exceeded
- ST-NMG-017 - Class name matches default namespace
- ST-DBP-002 - High Arguments Count
- ST-DBP-003 - Empty Catch Block
- ST-DBP-007 - Multiple Flowchart Layers
- ST-DPB-010 - Multiple instances of [Workflow] or [Test Case]
- ST-DBP-020 - Undefined Output Properties
- ST-DBP-021 - Hardcoded Timeout
- ST-DBP-023 - Empty Workflow
- ST-DBP-024 - Persistence Activity Check
- ST-DBP-025 - Variables Serialization Prerequisite
- ST-DBP-027 - Persistence Best Practice
- ST-DBP-028 - Arguments Serialization Prerequisite
- ST-USG-005 - Hardcoded Activity Properties
- ST-USG-009 - Unused Variables
- ST-USG-010 - Unused Dependencies
- ST-USG-014 - Package Restrictions
- ST-USG-017 - Invalid parameter modifier
- ST-USG-020 - Minimum Log Messages
- ST-USG-024 - Unused Saved for Later
- ST-USG-025 - Saved Value Misuse
- ST-USG-026 - Activity Restrictions
- ST-USG-027 - Required Packages
- ST-USG-028 - Restrict Invoke File Templates
- ST-USG-032 - Required Tags
- ST-USG-034 - Automation Hub URL
- Variables
- Arguments
- Imported Namespaces
- Coded automations
- Introduction
- Registering custom services
- Before and After contexts
- Generating code
- Generating coded test case from manual test cases
- Troubleshooting
- Trigger-based Attended Automation
- Object Repository
- The ScreenScrapeJavaSupport Tool
- Extensions
- About extensions
- SetupExtensions tool
- UiPathRemoteRuntime.exe is not running in the remote session
- UiPath Remote Runtime blocks Citrix session from being closed
- UiPath Remote Runtime causes memory leak
- UiPath.UIAutomation.Activities package and UiPath Remote Runtime versions mismatch
- The required UiPath extension is not installed on the remote machine
- Screen resolution settings
- Group Policies
- Cannot communicate with the browser
- Chrome extension is removed automatically
- The extension may have been corrupted
- Check if the extension for Chrome is installed and enabled
- Check if ChromeNativeMessaging.exe is running
- Check if ComSpec variable is defined correctly
- Enable access to file URLs and Incognito mode
- Multiple browser profiles
- Group Policy conflict
- Known issues specific to MV3 extensions
- List of extensions for Chrome
- Chrome Extension on Mac
- Group Policies
- Cannot communicate with the browser
- Edge extension is removed automatically
- The extension may have been corrupted
- Check if the Extension for Microsoft Edge is installed and enabled
- Check if ChromeNativeMessaging.exe is running
- Check if ComSpec variable is defined correctly
- Enable access to file URLs and InPrivate mode
- Multiple browser profiles
- Group Policy conflict
- Known issues specific to MV3 extensions
- List of extensions for Edge
- Extension for Safari
- Extension for VMware Horizon
- Extension for Amazon WorkSpaces
- SAP Solution Manager plugin
- Excel Add-in
- Studio testing
- Troubleshooting
- About troubleshooting
- Assembly compilation errors
- Microsoft App-V support and limitations
- Internet Explorer X64 troubleshooting
- Microsoft Office issues
- Identifying UI elements in PDF with Accessibility options
- Repairing Active Accessibility support
- Validation of large Windows-legacy projects takes longer than expected

Studio user guide
Best practices
To ensure that your coded automations are efficient, maintainable, and scalable you need to follow their best practices. This section provides an overview of key best practices to remember as you embark on your journey of leveraging code to build automation solutions. Adopting these best practices will help you design coded automations, specifically when structuring your code, implementing error handling strategies, or creating reusable components.
Using templates with low-code automations
If you are using types or methods from a code source file (CS) in a low-code automation (XAML), be aware that having them in a template from which you create a project, or exporting such files in a template can disrupt the namespaces in your XAML file. This disruption will prevent your project from running in Studio.
Objects used as arguments in code source files
Data objects used as arguments in code source files must have an empty constructor. Otherwise, Studio cannot serialize the workflow.
Parallelism
Parallelism improves performance, and implementing it in coded automations is easier. A Parallel.ForEach loop can increase the speed with which an automation executes.
Nested classes
Coded automations (CS files) don't support using or invoking variables or arguments from nested classes within low-code automations (XAML files). If you try to invoke these type of arguments using an Invoke Workflow File activity, or to create such arguments in XAML files, then you'll receive errors. We recommend using variables and arguments from nested classes only within other CS files.
Coded workflow inheritance
Coded workflow inheritance promotes code reusability and modularity, allowing you to create a hierarchy of classes where child classes inherit and extend the functionality of parent classes. This inheritance hierarchy facilitates the organization of code and avoids duplicating common functionality across multiple classes. Additionally, it simplifies maintenance and updates because changes made to the parent class automatically transmit to its child classes, reducing the chances of introducing bugs or inconsistencies.
Let's demonstrate how inheritance works using three classes: CodedWorkflow, ParentFile (an intermediate class that inherits CodedWorkflow and contains a custom method), and MyCustomWorkflow along with AnotherCustomWorkflow (derived classes that inherit ParentFile). The table below shows how inheritance between these classes and files works:
| Coded automation | Description | Code |
|---|---|---|
CodedWorkflow (read-only partial class) | This class serves as the foundation for all coded workflows. It contains essential methods and properties that are common to all workflows, inherited from the CodedWorkflowBase class. In this example, it is the class from which all other workflows ultimately inherit. Important: The file you want other workflows to inherit must also inherit the CodedWorkflow and implicitly the CodedWorkflowBase classes. This ensures all workflows inherit essential functions and work as expected. | public partial class CodedWorkflow : CodedWorkflowBase { public CodedWorkflow() { //... } } |
ParentFile (code source file containing an intermediate class and a custom method) | This class inherits from CodedWorkflow and adds custom methods and functionality. In this example, it includes a custom method called CustomMethod , which performs specific actions, such as starting a job in Orchestrator. | public class ParentFile : CodedWorkflow { public void CustomMethod(string processName, string folderPath, StartProcessDtoJobPriority jobPriority, bool resumeOnSameContext, out string jobId) { // Enter your custom code here. // For example, use the StartJob coded automation API inside this custom method. jobId = system.StartJob(processName, folderPath, jobPriority, resumeOnSameContext); } } |
MyCustomWorkflow and AnotherCustomWorkflow (coded workflows that inherit the code source file) | These classes inherit from ParentFile and further customize the workflow by overriding methods or providing different parameter values. In this example, we have MyCustomWorkflow and AnotherCustomWorkflow , both of which inherit ParentFile . | public class MyCustomWorkflow : ParentFile { [Workflow] public void Execute() { // You can now call CustomMethod from the base class. string processName = "YourProcessName"; string folderPath = "YourFolderPath"; StartProcessDtoJobPriority jobPriority = StartProcessDtoJobPriority.Normal; bool resumeOnSameContext = false; string jobId; // Call the custom method from the base class. CustomMethod(processName, folderPath, jobPriority, resumeOnSameContext, out jobId); } } |
In conclusion, because ParentFile inherits from CodedWorkflow, any class that inherits from ParentFile indirectly inherits the functionality and methods of CodedWorkflow. In other words, both MyCustomWorkflow and AnotherCustomWorkflow inherit the core functionality from the CodedWorkflow partial class through the intermediate ParentFile, along with other custom classes, such as CustomMethod.
Registering custom services
To enhance your coded automations, using custom logic, you can register custom services that you later use in your coded automations. Visit Registering custom services to learn how to register your own custom service.
Before and After contexts
Within test cases, the Before and After contexts allow you to execute certain actions before and after the test case is run. These contexts are commonly used to set up and tear down resources, perform logging, and manage the test environment. Visit Before and After contexts to learn how the contexts behave and how to implement them.
Tips and tricks
Design efficient and robust coded automations using the following tips and tricks. This collection of insights helps you to optimize your code, avoid errors, and maximize performance.
- We recommend that you do not make any changes to namespaces.
- Store an action inside a class and reuse it throughout your project, so you avoid duplicating code.
- You can remove namespaces that you imported during design time, but aren't necessary anymore.
- If you need to get data from multiple applications, separate the phases of the coded automation, so you don't mix data coming from various sources.