Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Application methods and Windows forms

Application methods are single-purpose automations that you can create to use in automations, just like any out-of-the-box method. Use Application methods when automating common tasks within a single application to make the end-to-end process more efficient.

For example, you need to create a solution that logs into an application, searches for a customer, and updates the customer's address. Because these are common tasks that you are likely to use in multiple use cases, create application methods for each task and call them from external automations.

Applications have methods that are available out of the box, such as Start, Stop, Hide, and Show. The Application methods feature allows you to add your own custom methods to applications. Use application methods as building blocks that perform commonly used functions, such as LoginAccountSearch, and AddNote. Application methods are private to the application and cannot be directly used by other automations within the project. Instead, the application methods are available in the Select action dialog box, with the other out-of-the-box methods.

Application methods support the best design practice to create small, modular automations that other projects can share and reuse. Application methods help to keep projects organized, maintainable, and scalable. They also support team development. 

Like automations, Windows forms can be created for an application, which means that only the automations stored alongside the application can use the Windows form and its controls.

In the following image, click the + icons to view details about the organization of a project that uses application methods:

Add an application method

You can add a new application method in the Project Explorer by right-clicking an application to access the Application Method option in the Add menu.

Adding an application method to the project

The name on an automation tab indicates that the application method is within the scope of a particular application. For example, the LogIn automation, created in the scope of the BankerInsight application, is called BankerInsight.LogIn

After adding the application method, Pega Robot Studio includes the application in the Palette. External elements are not available underneath the application, such as:

  • Globals
  • Other applications
  • Automations that are not scoped within the application

For example, an automation developer adds a new application method to the project presented above. In the following image, click the + icons to see the availability of the project elements to application methods:

Default application methods

In addition to creating your application methods, Robot Studio adds the following default application methods when you add a new application or webpage. Locate the default methods in the Application method and forms section of the palette. 

Default application methods in the palette

The StartApp application verifies whether the application is running and starts it if it's not. Conversely, StopApp checks to see if an application has stopped and terminates it if it has not. 

Visibility of the application method

Application methods are exposed to the rest of the project as methods on the application interface. Application methods have two types of visibility: Public and Private. An application method set to Private is usable only in the scope of an application itself, such as by other application methods. If your application method needs to be available outside of the scope of an application, set the Visibility type to Public. The automation needs to have a defined entry point.

Screenshot showing the visibility property adjustment for an application method set to Private.

You can also use publicly visible application methods in automations that are out of the scope of an application. For example, an automation developer wants to use the AddTransaction application method in the main automation of the project. The developer includes the application to access the method and then drags the main control of the application to the automation surface. The application method is then available in the Select action dialog box, as shown in the following figure:

Animated image showing the addition of an application method to the automation surface.

Move the application method

To move an automation under an application, ensure that you have no dependencies on global components, other applications, or automations. For example, if your automation uses a Microsoft Office connector that is stored in your Globals, Pega Robot Studio notifies you that this operation is not allowed because of dependencies. 

Name automation methods

The name of the application method needs to be unique only within the scope of the application. In the following example, three automations are named LogIn, but each exists within a different scope. 

Note: If you try to add an automation named LogIn in the Expense Tracker folder, you will receive an error because the folder is in the global scope, and this name would not be unique.  
Naming scoped automations

An application method's name cannot conflict with out-of-the-box method names for the application. The system will prompt you with an error if you attempt to name an application method with one of the reserved method names. 

Return values in an application method

When running an application method, you do not have information about whether an automation completed successfully. For this reason, it is a best practice to include a Boolean return value indicating the status of the application method. To implement Boolean return values, use Labels and Jump To blocks in the application method to set the value, True for a successful operation and False for a failed operation, and pass that value to the Exit block.

Screenshot showing Success and Failed labels with Boolean values.

 

Adding Boolean return values to the application method allows you to properly route the automation to handle errors. The following image shows an automation where a failed log-in is routed to the Failed label.

Screenshot showing an automation routing to the Failed label on an unsuccessful Login attempt.

 

Application Windows forms

The automation developer can also create an Application Windows form. To add a Windows form underneath the application, right-click the application name and select Add > Application Windows form

Adding scoped windows form

The Application Windows form is available only in the automation methods Include menu.

Check your knowledge with the following interaction:


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