Skip to main content

Best practices in creating robotic automations

When a customer requests to create a robotic project, the focus of the development team is to fulfill the requirements and create a legible, maintainable, and flexible project that is effortless to develop in the future. Discover the best practices for robotic automation projects, consider these practices while planning, and then apply them during development to help accomplish the business outcome of the team.

While planning and designing a robotic project, keep the following principles in mind: 

  • Aim to create one automation for an individual task. 
  • Name project elements like automations or design blocks to reflect the action taken.  
  • Validate input and output parameters.  
  • Ensure the known and expected state of the application and its controls. 
  • Be aware of the timing requirements of the application.  
  • Use provided tools to analyze, debug and fix possible problems, starting from the development phase.   
  • Provide the status of every automation when it finishes the task. 

General rules for creating automation 

Robotic automations and subautomations might interact with an application or webpage, and the goal is to retrieve some data from the application or set a desired value in the application. When planning your project, you can graphically represent the interaction between the robot and the application as a sequence diagram.

For example, an insurance company uses an unattended robotic project to issue payment for an insurance claim. The robot logs in to the banking application, collects customer contract data, and then makes the payment. 

In the following figure, click the + icons to learn more about the types of automation you need in your project to accomplish the request:

Implement different types of automation as a separate sub-automation. Create automations of small size and single purpose. The name of the automation should reflect the action it takes, for example, CollectCustomerData, GetAddress, and DisplayReservationForm.

Use the Label/JumpTo component if your automation contains multiple actions to fit the screen horizontally. If the automation flow branches off, use descriptive labels to make the automation more readable and easier to follow. For example, divide the FillInReservationForm automation, as shown in the following figure: 

An example use of Label/JumpTo component to keep automation readable.

Automation entry

Before you proceed with the automation and work on data, validate the input parameters. Numeric values should be in an acceptable range; string variables cannot be null. For example, work on files or directories. Before you begin reading or writing from the file, use FileExists or DirectoryExists methods from the Data handling section of the Toolbox as shown in the following figure.

Screenshot showing an automation with validation of input parameters.

When designing an automation flow, you need to check the application state; check if the application is running and the expected screen or webpage is currently displayed. All controls should be adequately identified and ready to use. 

When you analyze the application that you work with, pay attention to multiple instances of the same object that display simultaneously. For example, the customer support application displays a case form in a new window for each customer. To distinguish between instances and handle the application correctly, use the UseKeys property.

Note: For more information about the UseKeys property, see Application of keys.

Execution paths and error handling 

Before creating the robotic project, the team needs to analyze the application behavior and identify use cases, timing requirements, and the data range. Handle every deviation by using design blocks with the result output parameter. As a best practice, connect error codes with application work, absence of controls, data validation, and file manipulation. Use the Message Manifest component to log the actions taken and inform the user about the cause of the error.

Apart from having automations that work on data, your project also requires navigation automation that allows you to set yourself on the correct screen of the application. If you navigate between pages or frames, use the WaitForCreate method to ensure the desired element is ready or WaitAll/WaitAny to ensure the application created the desired elements correctly.

When creating automations, use the project analysis tool frequently. With this tool, you can find any inconsistencies in your project at the early stage and form best development practices. Project analysis tool also helps maintain organizational standards. 

Automation exit 

When completing a particular flow in unattended or attended automation, submit and close all the forms, and then return to the main page or known location.

Ideally, at the end of a specific robot task concerning the application, there should be a single exit point that handles all possible corresponding actions. Always place exit points at the bottom of the automation. Indicate the automation result; use properly named exit points, a boolean value, or both. Make sure to provide appropriate messages when exiting with failure. 

Check your knowledge with the following interaction:

This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice