Activities are composed of one or more sequenced steps. Each activity step must specify a method that describes the action the system takes.
A step page is a page in memory on which the method is processed. By default, the activity runs in the context by which it is called. For example, an activity that is called from a utility shape during case processing runs against the page assigned to the case type (pyWorkPage).
In the following image, click the + icons to learn more about configuring an activity:
Activities run steps in numbered order. Loop, When, and Jump indicates an action or condition when you want to repeat steps or alter the sequence in which steps run.
In the following image, click the + icons to learn more about activity actions and conditions:
Methods to call other activities
Activities can call other activities, which allows a developer to create modular activities and potentially reuse standard activities. Pega Platform™ provides two methods to run another activity: and .
Pega runs the specified activity, then returns control to the calling activity when the called activity process finishes. Consider two activities, A and B: If A calls B, then control returns to A when B finishes.
Pega Platform runs the specified activity, but the control returns to the rule that calls the first activity. The original activity ends when the branched activity is complete. Consider two activities, C and D: If C branches to D, when D (the branched activity) is complete, the control returns to the rule that called activity C.
Note: To learn more about creating an activity, see Creating an activity.
Parameters define variables that input data to, or return data from, an activity.
Parameters make activities more reusable by allowing you to pass arguments when the activity is called, rather than upfront during development.
- Activity parameters are defined on the Parameters tab on the Activities form.
- Use the notation param.<ParamName> to reference a parameter value.
- Parameter names and values are held on a special clipboard page, known as the parameter page, which is not visible with the Clipboard tool.
To better protect your application, limit how and for whom an activity can run by configuring activity-specific access control. Use the settings on the Security tab of an activity rule to specify the activity type and optionally restrict which users (or other requestors) can run the activity.
Use the security settings in the Restrict access section to restrict how — or if — users run the activity at run time.
Select the Allow invocation from browser check box to allow users to start this activity directly through user input processing, such as a Submit button or a pyActivity= element in an URL. Clear this if you intend this activity to start from only another activity, through a Call, Branch, or other means.
Caution: For most activities, leave this check box cleared to promote the security of your application. Allowing activities to be started from a URL or other user input (whether the requestor is authenticated or a guest) may let users bypass necessary checking, security, or setup steps.
Select the Require authentication to run check box to require that only authenticated requestors can start this activity. Clear the check box to allow guest users to run this activity if they meet other security and access criteria.
Note: Require authentication to run is selected by default on new activities. In most cases, you do not need to change this selection.
Identify one or more privileges to restrict the users and other requestors that can run this activity. At runtime, if the user does not belong to an access group that provides access to one of the identified privileges, the execution of the activity fails.
Note: To learn more about using the settings in the Restrict access section of the Security tab on an activity, see Securing an activity.
Select an activity type for the activity to determine whether and how this activity can be referenced in other rules. For example, selecting the Route activity type restricts the use of the activity to routing assignments in the case workflow. The Activity type list provides the following options.
|Select when no more specific value is applicable. Activities with this value cannot be referenced directly in flow rules.
|Deprecated, do not use.
|Select if the activity is referenced from an assignment shape in a flow rule. Assign activities are used to create the assignment and differ from other activity types that may be called from an activity, such as Notify and Route activities.
|Select if the activity runs in a background thread asynchronously. The activity can call only these step methods: Load-DataPage, Connect-Wait, and Call-Async-Activity (step instruction to allow a user to load an asynchronous activity).
|Load Data Page
|Select if the activity adds values to data pages. Reference this activity on the Definition tab of a Data Page rule.
|Deprecated. Only available for existing activities that use locatable pages.
|Select if the activity is used to notify a user or users of a pending assignment.
|Select if the activity is run automatically by a Declare OnChange rule.
|Select if the activity is used to route an assignment in a flow rule.
|Select if the activity calls a connector rule to interface with an external system.
|Select if the activity is run automatically by a Declare Trigger rule.
|Select if the activity is called from a Utility shape in a flow rule.
|Deprecated, do not use.
Note: To learn more about setting the activity type for an activity called from a flow rule, see Security tab on the Activity form.
Activity best practices
- Whenever possible, use alternative rule types, such as using a data transform to set a property value.
- Avoid using hard-coded reusable values in properties, for example, URLs or classes. Instead, use data pages, decision tables, or map values.
- Keep activities short. Limit your activities to fewer than 25 steps, and focus each activity on completing one task.
- Use reusable activities.
- Use the Description field to describe what each activity step does.
- Set an appropriate Activity type in the Security tab to remove warnings. For example, Utility (default), Validate, and Load Data Page.
- Reduce or eliminate the use of duplicate loops to improve application performance.
- Remove commented lines before merging your rules unless the commented lines help clarify the details of the activity.
- Avoid using deprecated activity methods.
- Limit hand-coded Java. Avoid Java steps in activities when standard or custom rule types, library functions, or activity methods are available.
Caution: The Java method allows you to add custom Java code to an activity. Use this method with extreme caution. The use of a custom Java code in activities is a severe violation of Pega application development best practices because it introduces maintainability issues. Use the Access Control Check landing page to identify activity calls that require mitigation. To learn more about the Access Control Check landing page, see Using Access Control Checks.
- Use parameters to clearly define the inputs and outputs so that system architects understand how the activity is used and increase application maintainability. If the activity needs a specific value to process, pass a scalar parameter rather than a complete page reference.
Check your knowledge with the following interaction: