Understanding and Using Parameter in Pega Systems

Parameter in Pega Systems

In Pega Systems, parameters play a vital role. These parameters are the essential building blocks for passing data between rules, ultimately controlling your application’s flow and behavior. Here’s an overview of understanding and effectively utilizing parameters in Pega and using Parameters in Pega Systems.

What is the Parameter in Pega?

Parameters in Pega are used to pass data into or out of rules such as activities, data transforms, report definitions, and more. They help make regulations more reusable and dynamic by allowing the same rule to operate on different data depending on the context in which it is used.

Types of Parameter in Pega

Input Parameters: These parameter are used to pass data into a rule.
Output Parameters: These parameter are used to get data out from a rule.

Setting Up Parameter

Activities
To define parameters in an activity:

1.Open the activity rule form.
2.Go to the “Parameters” tab.
3.Add the parameters with their names and data types.

Within the activity, you can access these parameters directly. Simply use the “Param” keyword followed by a period and the specific parameter name. For example, to access a parameter named “MyParameter,” you would use “Param.MyParameter.”

Data Transforms

In data transforms:

Go to the “Parameters” tab and define the parameters.
Use the parameters within the data transform using the Param keyword.
For example, to set a property using a parameter, you might have:

Set .PropertyName = Param.YourParameterName
Report Definitions

In report definitions:

1.Define the parameters in the “Parameters” tab.
2.Use the parameters in the query to filter results or in calculated columns.
3.Passing Parameters

When invoking rules that have parameters, you can pass values to these parameters using various methods such as:

1.Direct Invocation: When calling an activity or data transform from another rule, you can specify the parameter values directly.
2.Using Data Pages: Furthermore, data pages exhibit a valuable capability: they can accept parameters. This functionality allows them to dynamically fetch context-specific data based on the provided parameters.
3.From UI Elements: Pega extends its flexibility by allowing parameters, including sections and flow actions, to be passed from UI elements.

Examples

Example of Using Parameters in an Activity

1.Define parameters in the Parameters tab:

‘param1’ (String)
‘param2’ (Integer)

2.In the activity steps, use the parameters:

1. Property-Set
.Property1 = Param.param1
.Property2 = Param.param2

3.When calling this activity from another rule, pass the parameters:

Call YourActivity
Param.param1 = “Sample Value”
Param.param2 = 123

Example of Using Parameters in a Data Transform

1.Define parameters:

‘inputParam’ (String)
‘outputParam’ (String)

2.Use the parameters in the data transform:

 Set .OutputProperty = Param.inputParam

To set the output parameter:

Set Param.outputParam = .AnotherProperty

Example of Using Parameters in a Report Definition
3..Define parameters:

status (String)

4,.Use the parameter in a filter condition:

.Status = Param.status

Best Practices

1.Meaningful Names: To enhance code readability and maintainability even further, prioritize using meaningful names for your parameters. By adopting this practice, you’ll significantly improve the clarity and understandability of your code for both yourself and others who may interact with it in the future.
2.Documentation: Therefore, to enhance code readability and maintainability, directly document the purpose and expected values of all parameters within the rule description itself.

3.Validation: Ensure that the parameter values are validated before use to avoid errors during execution.

Param in Pega

In Pega, Param is a keyword used to reference parameters within rules such as activities, data transforms, and others. consequently, Parameters allow for the dynamic passing and retrieval of data, making rules more flexible and reusable.

Using Param in Pega

Defining Parameters

Activities:

1.Open the activity rule.

2.Navigate to the “Parameters” tab.

3.Define the parameters with names and data types.

Data Transforms:

1.Open the data transform rule.
2.Navigate to the “Parameters” tab.
3.Define the parameters with names and data types.

Report Definitions:

1.Open the report definition rule.
2.Navigate to the “Parameters” tab.
3.Define the parameters to be used for filtering or other purposes.

These are just like Properties that cannot be created underclasses.

Furthermore, these parameters can be conveniently defined within the dedicated Parameter tab of rule forms.

We can pass values to parameters, which means While calling the rule that has parameters defined on it, we can pass values.

Example: Open child activity & Define parameters.

Now, let’s navigate to the Steps tab.

Once there, hit Save to capture your progress.

Next, open the Parent Activity and expand the specific Call step within it.

At this point, you’ll likely see a prompt requesting values for the parameters involved in the call.

When you call a child activity rule in Pega, it might prompt you to enter values for its parameters.

These parameters can then be accessed conveniently using the pre-defined page named “Param.”

It’s important to note that unlike regular pages, the “Param” page doesn’t get created on the clipboard.

To inspect the “Param” page data during application execution, utilize the Pega Tracer tool.

Importance of Parameters.

Parameters in Pega Systems
Parameters in Pega Systems
Passing Parameter page from one rule to another rule:

Next, The above one is passing parameter values.

However, selecting this option will initiate the passing of the parameter page from the current rule to the called rule.  Note that the system disregards any additional parameter values provided below.

  1. Always verify that you have defined all child rule parameters in the parent rule before passing a parameter page.
  2. Before passing parameters between rules, ensure that the names and data types of the parameters on both the parent and child rule match exactly.
  3. Before selecting the “pass current param page” option, assign values to the parameters on the parent rule.
  4. Means we are setting parameters values at parent activity and then passing the  entire param page.

 

Let’s get hands-on! We can mirror the child rule’s parameters by defining them directly within the parent rule.

Alright, time to put your skills to work! As a first and crucial step, let’s strategically insert a new step directly above the Call step. This newly created zone will act as your designated workspace for defining the parameters needed for the child rule call.

Fantastic! With the new step strategically positioned, you’ve successfully laid the groundwork. Now you can define the parameters required for the call to the child rule. Feel free to leverage clear and descriptive names as you create these parameters, enhancing code readability for the future. Feel free to leverage clear and descriptive names for these parameters, as they’ll enhance code readability in the long run.

Conclusion

Furthermore, Parameters in Pega Systems emerge as a powerful feature in Pega. Their effective definition, utilization, and passing significantly enhance the flexibility and reusability of rules. Consequently, you can craft more dynamic and maintainable Pega applications.

More topics on the technology click here

Leave a Comment