Thursday, September 19, 2024

How do I add a field value to a section in PEGA?

Section in Pega

Adding a field value to a section in Pega involves several steps. Here’s a step-by-step guide to help you achieve this. Let’s delve into more details, covering specific scenarios and additional considerations when adding field values to sections in Pega.

Step 1: Create the field value.

Section in Pega
Section in Pega

1.Log into Pega Developer Studio.

2. Navigate to Records Explorer on the left-hand side.

3. Select field values under the Data Model category.

4.Click on Create Field Value.

5.Fill in the details:

  • Applies To: Select the class where this field value will be used.
  • Field Name: Enter the name of the field.
  • Field Value: Enter the value for the field.
  • Localized Value: (Optional) Provide a localized value if necessary.

6.Save the field value.

Step 2: Add the field to a Pega section.

1.Open the Section Rule:

Navigate to the section where you want to add the field value. This can be done via the Records Explorer or by directly searching for the section in the search bar.

2.Design the section:

Drag and Drop: In the section rule form, use the “Design” tab to drag and drop the field from the available fields or the Data Model.

3.Configure the field:

Properties Panel: Click on the field that you just added to the section to open the properties panel on the right-hand side.

4.Property:

Set the property to match the field value created earlier.

Control: Choose an appropriate control type (e.g., text input, dropdown) depending on how you want the field to be presented.

5.Save the section.

Step 3: Test the Field

Section in Pega
Section in Pega

1.Run the case type:

Open the case type where the section is used.

2.Create a new case:

Verify that the new field value appears in the section and behaves as expected.

Example: Adding a Dropdown Field Value to a Section

Suppose you want to add a dropdown for “country” with specific values.

1.Create Field Values:
  • Field Name: Country
  • Field Values: USA, Canada, Mexico

Create these field values as described in Step 1.

2.Add Field to Section:
  • Open Section: MyApp-Work-SectionName
  • Drag and Drop: Drag a drop-down control into the section.
  • Configure:
  • Property: .Country
  • Control: Dropdown
  • List Source: Local List (configure the local list to include the USA, Canada, and Mexico as options).
  • Save and test:

Save the section and run a case to see the dropdown with the field values.

Advanced Steps and Scenarios

Scenario 1: Using Field Values for Localization

Pega allows field values to be used for localization. Here’s how you can manage localized field values in a section:

1.Create localized field values:
  • Follow the same steps as creating regular field values.
  • In the “Localized Value” field, enter the translation for different languages.
2.Using Localized Field Values in Sections:

When configuring the control in the section, Pega automatically picks up the localized values based on the user’s locale settings.

Scenario 2: Dynamic Field Values Using Data Pages

Sometimes, field values need to be dynamic, populated from a database or an external service.

1.Create a Data Page:
  • Navigate to Records Explorer and select Data Pages under Data Model.
  • Create a data page that fetches the necessary data.
2.Configure the field in the section:
  • Property: Set the property to the field you are working with.
  • Control: Choose a drop-down.
  • List Source: Select “Data Page.”.
  • Data Page: Specify the data page created earlier.
3.Map Fields:

Map the fields in the data page to the dropdown control (e.g., map ID to the option value and Name to the option display).

Scenario 3: Conditionally Displaying Field Values

You might need to show or hide field values based on certain conditions.

1.Define visibility conditions:

In the section, select the field.

Properties Panel: Go to the “Visibility” tab.

Visibility Condition: Set a condition (e.g., only show this field if SomeProperty == true).

2.Use When Rules for Complex Conditions:

Create When Rule: Navigate to Records Explorer and select When under Decision.

Define the logic: Create the logic for your condition.

Apply When Rule: In the section, set the visibility condition to use the created When rule.

Best Practices On Section in Pega

1.Reusability:

Create reusable field values and sections. This approach reduces redundancy and makes maintenance easier.

2.Naming Conventions:

Use clear and consistent naming conventions for field values and sections to improve readability and manageability.

3.Performance Considerations:

Minimize the use of large data pages and heavy computations in sections to maintain good performance.

4.Version Control:

Keep track of changes to sections and field values using Pega’s versioning and revision tools.

5.Testing:

Thoroughly test sections in various scenarios to ensure that field values are populated and displayed correctly.

Example: Advanced Field Configuration

Suppose you want to add a dynamic dropdown for selecting “Product” that fetches data from a database and is displayed only if a checkbox is selected.

1.Create a Data Page:

  • Name: D_ProductList
  • Source: Database Table (or a REST service)

2.Create a When Rule:

Name: ShowProductDropdown

Logic: IsProductSelected == true

3.Configure the section:

  • Checkbox: Add a checkbox for selecting products with the property. IsProductSelected.
  • Dropdown:
           Property: .SelectedProduct
           Control: Dropdown
           List Source: Data Page
          Data Page: D_ProductList
         Visibility: Use the When rule. ShowProductDropdown

4.Map Fields in the Data Page:

  • Ensure the data page returns a list with fields like ProductID and ProductName.
  • This rule can be created under the Data Model Category.
  • This rule can be used to set work object status.
  • We create field values for work. Object status must be associated with the OOTB property pyStatusWork.
  • pyStatusWork is on the OOTB property, which holds work object status on pyWorkPage. The same column will be available in the work table.

Conclusion

This should add the desired field value to the specified section in Pega application. If you encounter any issues or need further customization, refer to the Pega documentation or consult with your Pega system administrator.

More topics on technology click here

 

 

 

techvlogs
techvlogshttp://techvlogs.com
This Blog is dedicated to the Technology. We through this Website would cover the latest and trending Technologies in India and around the World. It is a dedicated Blogging Website which covers all the technical news across the Industries. We would also provide latest programming languages and updates in Global Market.

Most Popular

Related Articles

What is JavaScript Node.js Server-Side Example with Simple Code?

JavaScript, traditionally used for client-side web development, has gained significant traction in server-side js development through Node.js. Node.js is a runtime environment built on...

What is JavaScript Animation, css, Canvas API and WebGL?

JavaScript animation, CSS, Canvas API, and WebGL are pivotal tools in modern web development. These technologies are integral to creating dynamic, interactive, and...

What is TypeScript and flow in javaScript with example?

JavaScript is a versatile, dynamic language commonly utilized in web development. However, it lacks built-in type checking, which can lead to bugs and...