Best Practices
We have created this document to ensure your process is easily readable, reliable, and follows development standards and best practices.
General Design Guidelines
- Avoid hardcoding values. Instead, store them in variables with intuitive English names (without spaces).
- Establish clear variable naming conventions and follow them consistently.
- Use Global Variables for any value that:
- Changes across environments
- Is used in multiple processes
- It is recommended to create a reusable process template that includes:
- A standardized process structure (e.g., initialization, local functions, body, exception handling)
- Predefined Exception Handling mechanisms
This helps improve standardization, reusability, and long-term maintainability.
- Initialize the process at the beginning by:
- Setting up variables
- Closing all running applications to ensure a clean start
- Grouping these steps together to improve visibility
- If there is an existing process in production that is very similar to the one you need to build:
- Consider using start arguments to differentiate process behavior (e.g., based on region or robot)
- Avoid duplicating the process unnecessarily, as this leads to double maintenance
- This approach is ideal for cases where the process logic is mostly the same but varies slightly across countries, business units, or robots
File and Folder Organization
- If your process requires input/output files:
- Create a folder named after the process
- Store all necessary files there
- Ensure the folder is created on the robot’s machine before publishing to Test or Production
Functions and Reusability
- Use Functions wherever possible to promote modularity, efficiency, and easier testing.
- Save logically independent parts of the process as separate Functions.
- If multiple processes use the same application, create dedicated Functions for:
- Logging in
- Each application-specific operation
- If a functionality is specific to one process but needs to be reused multiple times within that process, you may create a Local Function.
- Local Functions should be created at the beginning of the process
- Group all local functions together for better readability and navigation
Step and Group Naming
- All steps in the process must be clearly named, reflecting their purpose.
- Group related steps into logical sections and give the group a descriptive name.
- Use different group colors to improve visibility.
- Provide descriptions for each group.
Script Usage
- For any external scripts (e.g., batch, PowerShell, VBScript) comment and document its purpose clearly
- Note that issues resulting from custom or user-developed code fall outside the scope of official support.
- Avoid using the Script step unless it is absolutely necessary because external libraries or legacy .NET assemblies may not be compatible with the current runtime environment. To avoid such issues, consider using the Python Script step, where users can manage their own Python version and maintain the code independently
Error and Exception Handling
- Create an Error Handling section (using Error Mode) to manage unexpected exceptions that the robot may encounter during runtime
- Consider creating a dedicated Error Handling Function
- If an error is anticipated or known, implement a structured Exception Handling mechanism to deal with it appropriately
- Use Try/Catch blocks where possible
- Ensure graceful exits with proper logging and user notifications
- Return to the main screen after exception or error so the process can continue with the next item
- Close all applications at the beginning, at the end, and in the Error Handling section
Loops and Data Row Handling
- If processing multiple entries (e.g., rows in an Excel file):
- Errors in one row must not block the processing of others
- After an error, the process should return to a stable state
- Consider implementing a dispatcher/worker pattern if suitable
Input Validation
- Validate all input data (e.g., Excel files, arguments)
- If invalid data is detected:
- Exit the process gracefully
- Notify the user of the business error
Desktop Application Guidelines
When working with desktop applications, please follow these recommendations to ensure stability, accuracy, and maintainability:
- Use the Recorder feature whenever possible to create automation steps for interacting with desktop applications efficiently.
- For Click and Find Image steps:
- Always enable Retry and Timeout options to give the robot time to detect the required image or UI element
- This avoids the need for fixed delays and ensures that the process waits dynamically for the screen to be ready
- Avoid fixed pauses for waiting on screens or images unless absolutely necessary
- If the image to be clicked is unique, there is no need to define anchors
- If there are multiple similar images, make sure to:
- Define unique anchors that clearly determine the position of the correct image
- Choose appropriate anchor types based on the UI layout and visibility
After finishing the process recording:
- Save the application path or URL to a variable
- Replace the static path in the Open Window Process Step with the variable for better flexibility and reuse
- The same recommendation applies to:
- Click & Type Step
- String Input Step
Final Cleanup Before Production
- Remove all disabled steps before publishing to production
- Avoid:
- Duplicate steps
- Declaring unnecessary variables
- Duplicating Functions
- Define and implement Key Performance Indicators (KPIs) in collaboration with process owners
Tips & Tricks
- Perform a manual run-through to identify areas for optimization
- When working with web applications:
- Use direct URLs when possible
- Develop the process step by step and test each part individually
- Avoid fixed pauses; use dynamic wait conditions with timeouts to prevent hanging
- Use the Recorder tool wherever possible
- Divide large processes into smaller, manageable parts
- Use knowledge of other technologies (e.g., API calls, database access, web services) to build more efficient automations
- Involve clients in the testing phase and ensure all scenarios are covered