What is activity?


Business logic implementation in form of sequence of steps

First take an example, during payment on ecommerce site, system has to validate the entered credit card details like credit card no.,Name printed on card, expiry date, security code etc. And if validation failes then show an error message else send to payment gateway.

Above is one business logic that would be triggered during case processing. To handle these types of requirements when some logic needs to be called, we use activity. Can say in java words, need to implement one method that will validate the credit card details.

All steps will be executed in sequence manner and each step handles different type of responsibility like:

Step 1: Fetch the credit card details.
Step 2: Validate the credit card details if fails goto Step 4
Step 3: Send to payment gateway for further processing
Step 4: Show the error message
Step 5: Close/Remove the temp objects

Java Code Implementation



public class creditCard {

	creditCardBean ccbean;
	public void validateCCDetails() {
		//Write down the business logic
	}
}                               

What can be achieved by activity:


1) Access Database
2) Create new clipboard page
3) Copy data to pages
4) Send correspondence
5) Calls another activity

Components in activity


Activity executes its steps in sequence manner. Flow can be controlled by defining pre-condition, jumping to later step, or looping of steps.

Each step is divided in 7 parts. activity action items

Action Item Detail
Label Works as identifier for referencing from other steps
Loop Loop conditons
When Before execution of method we have to check the condition written in when, if condition is true then execute the step else skip the same.
Method Describe which in built pega method or activity will be called
Step Page page that will be used as context for referencing properties means described method in Method section will be work on the page mentioned here. if it is blank, then pega automatically uses the page context of the rule calling this activity.
Description Describe purpose of the step, it is optional and it contains the answer of "what is happenning here". From development perspective it is required to inform future developers about the happenning.
Jump Jump defines post condition after executing a method, based on the method output would you like to go for next step or want to jump to later step. In case if method throws some exception then we can describe the later step label under "On exception, jump to later step label".
When

Before execution of method we have to check the condition written in when, if condition is true then execute the step else skip the same.

Once you click on when button, below window will ask "Enable condition before this action". activity action items If you checked the check box, then in below window we have to fill the details. activity action items Once condition is enabled then when button will look like so you can identify when condition is implemented on the step or not.

Example: Check if name variable has any value, if true then jump to later step labeled as "EXIT" else continue. activity example Below are the conditions under "if true" and "if false" sections:

Conditions Description
Continue whens continue the step execution
Skip whens Skip the other when conditions if first when condition is met. As you know in when window, we can put multiple when conditions.
Jump to Later Step Jump to the Step whose label is given under "true param" or "false param"
Skip Step Skips the current Step and execute the next step immediately
Exit Iteration Exit the iteration if you are inside a loop
Exit Activity None of the further steps will be executed and will come out from current activity

Jump

Jump defines post condition after executing a method, based on the method output would you like to go for next step or want to jump to later step. In case if method throws some exception then we can describe the later step label under "On exception, jump to later step label".

After clicking on Jump button, If you check the check box "Enable condition before this action", then below window appears where we have to fill the condition details. activity action items Once condition is enabled then jump button will look like so you can identify jump condition is implemented on the step or not.

Tabs in activity


Activity has below tabs:

Tab Name Purpose
Steps Contains the execution flow of activity
Parameters Describes parameters or local variables here
Pages & Classes Contains the list of page name and their respective classes
Security If we want to authenticate the user before execution of activity then select the checkbox stating "Require authentication to run"
Test Cases Can implement the test cases for the activity
History Contains the history like usage description of activity, last updated by details

Nested activity


where one activity calls another activity, just like nested methods in java. you can check article How to call another activity from one activity for more info.

What is use of may start and may authentication options in activities ?


Allow direct invocation from the client or a service(may start):
If option is checked User is allowed to start the activity directly on input processing
Example: click on submit button, call pyActivity = element in an url.
If option is unchecked When use tries to run the activity on user input, the activity will not run and returns status as fail:security.
Note: Clear this if activity is to be started only from another activity, through a Call, Branch, or other means like selecting checkbox or triggering ajax event.

Require authentication to run(may authentication):

If option is checked select to require when only authenticated users can start the activity.
If option is unchecked It allows guest users to run this activity, if they meet other security and access criteria. Guest users (unauthenticated requestors) — have access to rules in the RuleSets provided in the PRPC:Unauthenticated access group, as referenced in the Requestor type instance- pega.BROWSER.

Note: Need to clear this check box if the activity is for an agent. Agents are not true authenticated users and can't run activities those are restricted to authenticated users. One catch is here, this check box is ignored by agents for which the "Bypass activity authentication" check box on the Security tab is checked. It means those agents can run activites without authentication.
Note: If you run the service without authentication, you will get "You lack access required to run the activity" error as in order to run the activity, authentication is required.

Related Articles

post a comment