If you’re new to using Automation Anywhere, you may have noticed that there’s not a lot of online support. There are tutorials that can help you become familiar with the activities and capabilities of AA, but when it comes to designing effective, robust bots you may be a little overwhelmed and unsure of how to start. The following list contains design tips for beginners that aim to guide you in your journey to becoming an effective RPA Engineer.
Avoid Hardcoding Values
In many ways, developing a bot in Automation Anywhere is quite different than coding using a traditional programming language. However, like most traditional languages, Automation Anywhere allows the assignment of variables. And just like in traditional programming, it’s a good idea to avoid hardcoding values whenever possible. This will allow for easy and flexible refactoring, debugging, and testing. Examples of values that ought to be stored in variables are website URLs, folder/file paths, loop control values, window titles, and anything else that you think might change in the future.
Use a Configuration File
There may be some variables that you’ll want to be able to change without having to change the code of the bot. In such cases, it is easiest to setup a configuration file for the bot to read the values. Automation Anywhere has built-in functions to read from different types of files; XML and Excel spreadsheets are two types of files that, when formatted well, will be easy for the bot to read.
Divide Your Process into Sub Tasks
Some processes that you find yourself automating will be simple, straightforward, and may not contain very many steps. However, many more business processes will be complicated and have many potential points of failure. When given a process to automate, it’s a good idea to first divide the process into discrete, independent sub-processes that can be coded and tested separately before being executed together. This will increase code readability, modularity, and will allow for easier refactoring and debugging.
Make Use of the “Wait” and “Delay” Activities Effectively
When automating processes that involve web applications, you’ll often find yourself having to wait for pages to load before proceeding. Other times you’ll have to wait for specific elements on the screen to appear or change. Rather than using the Delay activity and hardcoding a wait time, AA has the Wait for Window and Wait for Screen change activities that should be used whenever possible for a “smarter,” more efficient bot. In rare cases, it may not be possible to give AA a specific indicator to wait for, in which case the Delay activity must be used. Try to use a variable for the delay value when possible. If you’ve performed Object Cloning activities, you may have noticed the “Wait for the Object to Exist: ___ seconds” option. This can also be used to help control the flow of your process. Use this field to specify a maximum amount of time that the automation should wait for the object to exist.
Comment Your Code Generously
Commenting is important for any type of software development, and coding bots in AA is no exception. Commenting is not only important for others to be able to read and understand your code, it can save you a ton of time throughout the development process. Activities in AA can often be long or get truncated, making them difficult to read at a glance. For instance, if you have several Object Cloning activities in succession, it’s much easier to pinpoint one if each line has a descriptive comment above it. This eliminates the need to double-click into activities to find the one you’re looking for. Personally, I like using comments to plan and design each of my tasks. When I create a new task in AA, the first thing I do is write a comment for every step that needs to be performed. This helps to guide me throughout development and keeps me organized, and it also helps to ensure that I don’t miss any process steps.