Skip to main content

Advanced techniques for using automation links

When writing automations in Pega Robot Studio, you structure specific types of data and move data efficiently through your automations. You can use the following techniques to manage data in your automations:

  • Data sensitive property
  • Threading
  • Type casting from a data port

Data sensitivity property

When executing automations containing sensitive data, such as passwords or identification information, consider using the Sensitive property. For the data links marked as sensitive, the actual data value is not stored as part of any log file, but the text "---Sensitive---" is sent instead.

To mark a data link as sensitive, you can use a context menu or select the checkbox in a property grid. For more information on implementation see Sensitive Data.

Threading

You use two types of threads in Pega Robot Studio:

  • User interface thread
  • Application threads

The user interface thread is responsible for painting the desktop window and displaying Windows Forms. This is the first thread that is created when a project starts, similar to the main thread. When the user interacts with a control of a Windows Form, the user interface thread receives and processes all user activity messages. 

All Windows Form events are raised synchronously and run on the user interface thread. 

When Pega Robotic automation Runtime starts an application, the system also creates a monitoring application thread. The application thread identifies the application's controls and raises events in response to user input. The application thread may raise events synchronously or asynchronously.

Automations run on the same threads as the event that triggered them. This approach allows automations to respond to synchronous and asynchronous events and control threading behavior by using asynchronous links.

Because the user thread is responsible for displaying elements on the screen, any long-running activity may give the impression that the user interface is not responding. To avoid this issue, always configure an automation that is triggered by a Windows Forms event to execute an asynchronous link when it interacts with non-Windows Form components.

Threading best practices:

  • Most automated applications are designed for user interactions, so an automation designer should simulate user behavior. Avoid interacting with two windows or applications at once.
  • When designing automation, do not use multiple threads when automating a single application and launch applications on-demand rather than all at once.
  • Creating too many asynchronous links in the automation results in too many threads that hinder response time and automation completion.

Type casting from a data port

A blue dot on a design block is called a Data port. This dot indicates data that passes into the left side of the design block, or that comes out of the right side of the design block. When data passes between blocks, specific simple data types are converted automatically, such as strings, integers, booleans, and doubles. Suppose you need to copy or transfer data from one variable to another, such as reading a spreadsheet value from a PDF document and then adding it to a numeric value already in your project. In this case, the PDF value is read as a string and then converted into a variable in your automation. A type conversion must occur before you can add those two values together. In most instances like these, an automatic type conversion occurs, but in more complex cases, such as where the data type is unknown, you should cast the type from the Data port.

By hovering your cursor over a data port, Robot Studio displays a tooltip that informs you of the data type on the design block that is required for that parameter. Use this hovering capability to remind you of the specified return value, as shown in the following figure:

Screenshot showing the data type being displayed in a tooltip while hover over the data port of a design block in Pega Robot Studio.

You update the data type on both the input and output ports because they both require the same value. You can update a text property by right-clicking a property name, and then selecting Advanced > Treat "Text" as > Pick type.

When you update a text property, your values can vary, as shown in the following figure:

Screenshot showing the Pick type option in the data value menu.

You can also directly choose String, Boolean, or Integer from the menu options.

If a data port has been cast to another data type, the right-click menu displays the Advanced > Reset type for "Text" option, as shown in the following image:

Screenshot showing the Reset type option in the data menu.

An exception can occur if you cannot convert the underlying data type to your chosen type. An everyday use case for this feature is when you want to use one of the Microsoft Excel connector methods. Without the new data port casting, you need to pass the method result to a jump label parameter to convert the object output to its known type. With the Treat "Value" as functionality, you can now cast the object to a known type directly on the method block to access its properties, methods, and events.

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