Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating an activity

Updated on May 31, 2022

Automate a system task for which a more appropriate rule type is not available by creating an activity. With activities, you define a sequential set of instructions, or steps, that the activity completes automatically. Each step calls a method or supported rule type to perform the required processing.

Consider a scenario in which an insurance company must submit insurance claims to the Registry of Motor Vehicles. To minimize the impact on users, you can configure an activity to automate claim uploads so that your application submits insurance claims outside of peak hours, without user intervention.
Before you begin: As a best practice, before creating an activity, investigate model-driven alternatives that can deliver the desired results. Alternatives such as data transforms, collections, declarative rules, and features of flows and case management can remove the need to create new activities. If possible, use the standard activities that Pega Platform includes. To view a list of all standard activities, flows, and flow actions that you can use in case management, in the header of Dev Studio, click ConfigureCase ManagementProcessesAPIs. Create a custom activity only if the standard activities cannot fulfill your business needs.
  1. In the header of Dev Studio, click CreateTechnicalActivity.
  2. In the Activity Record Configuration section, select Activity (legacy).
  3. In the Label field, enter a name that describes the purpose of the activity and helps identify the activity.
    Start activity names with a verb that indicates the purpose of the activity. Follow the verb with a noun or noun phrase that indicates an element on which the activity operates. Capitalize the first letter of each word in the name of the activity.
    For example: Name your activity CreateClassPage or GetHTMLFilePath to clearly convey the purpose.
  4. Optional: To change the identifier that other rules use to reference this activity, in the Identifier section, click Edit, and then enter a name that is unique within the Apply to class.
    Choose a name that starts with a letter and contains only letters, numbers, and hyphens. The name must be a valid Java identifier. The length of the class name plus the length of the identifier cannot exceed 128 characters.
  5. Optional: To automatically set the activity type and, in some cases, add prepopulated steps to the form, click View additional configuration options, and then select one of the available activity templates:
    • To create a route activity that you can use in an assignment shape to route an assignment to a worklist or work queue by using custom routing criteria, select Template for Route type activity for worklist. For more information, see Assignment shapes in processes.
    • To create a trigger activity that you can use in a Declare Trigger rule to set the values of parameters, select Template for Trigger type activity. For more information, see Creating Declare Trigger rules.
    • To create a utility activity that you can use to automate the processing of a case, select Template for Utility type activity. For more information, see Calling an activity or automation from a process.
  6. In the Context section, define the context in which to execute the rule:
    1. In the list of built-on applications, select an application layer for the activity.
    2. In the Apply to field, enter a class that you want to associate with the activity.
      At run time, the activity runs in the context of a page. The class that you specify in the Apply to field must be either the class of that page or in the class hierarchy of that page's class. For more information, see Understanding class hierarchy and inheritance.

      The list of available class names depends on the application context that you select.

    3. In the Add to ruleset list, select a ruleset and a ruleset version in which you want to store the activity.
  7. Optional: To override the default work item that your application associates with this development change, press the Down arrow key in the Work item to associate field, and then select a work item.
    For more information about your default work item, see Setting your current work item.
  8. Click Create and open.
What to do next: Define a sequential set of instructions, or steps, that the activity completes automatically. For more information, see Configuring steps in an activity.
  • Configuring steps in an activity

    After you create an activity, define a sequential set of instructions, or steps, that the activity completes automatically. Each step calls a method or supported rule type to perform the required processing.

  • Activity form - Completing the Steps tab - Entering Method parameters

    The Method Parameters section allows you to pass information from an activity to a method or instruction specified in the Method field of a step.

  • Activity form - Completing the Steps tab - Entering preconditions

    Use the When button to define a when precondition that conditionally skips execution of a step. The system evaluates whether specified conditions are met before it executes the method or instruction referenced in the step. If false, the rest of the step is skipped.

  • Defining step transitions in an activity

    Use the blue Jump button to open a pop-up dialog, and identify transitions, optional fields that can end iteration, terminate the activity, or cause control to jump to a later (higher-numbered) labeled step. Use transitions to specify conditions that are evaluated after the method in the step is performed, but before the execution continues with other steps.

  • Repeating steps in an activity

    Use the Loop button to identify iterations, optional fields that can define an enumeration of or loop condition for this step.

  • Calling an automation from an activity

    Call an automation from an activity without using a Java step.

  • Best practices for writing activities for background jobs

    Ensure that work items are processed correctly and that data is not corrupted during a node shutdown by using best practices for writing activities for background jobs.

  • Security tab on the Activity form

    Use the Security tab to specify the activity type and optionally to restrict which users (or other requestors) can execute the activity. This optional security supplants restrictions based on ruleset and version.

  • Defining the local variables for an activity

    Create scalar variables that you can use to pass information between the steps of an activity. Local variables require less memory and run faster than regular parameters.

  • Activity form - how to create activities for flows

    Use these instructions to create activities that can be called directly in flows.

  • Unit testing an activity

    You can test an activity individually before testing it in the context of the application that you are developing. Additionally, you can convert the test run to a Pega unit test case.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

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.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us