Skip to main content

Adding an entity

6 Tasks

20 mins

Pega Customer Service '24.1
Visible to: All users
Beginner
Pega Customer Service '24.1
English

Scenario

After reviewing the Common Data Model, you concluded that you need to extend it with an entity for contract data. Based on your organization's requirements, you decide to add an entity called Contracts, which has two fields, Active on and Expire on, which both are dates.

Use the following credentials to log in to the exercise system:

Role User name Password
DB administrator [email protected] install12345!
CDM administrator cdmadmin rules

Your assignment consists of the following tasks:

Task 1: Create and configure the Contract case type

Use the Case types explorer to add the Contracts entity, create the field ContractID, and the pyDefault data transform, and configure them for the Contracts entity.

Task 2: Add the database tables for the Contract case type

Use the provided database scripts to add tables for the case and history data. Map the added tables to the Contracts case type and its history classes.

Task 3: Optimize and add fields to the Contract case type

Optimize mandatory fields inherited from parent classes and add fields specific to the Contracts entity.

Task 4: Add indices for the Contract database table

Use the provided database script to add indices to the Contract database table.

Task 5: Configure Common Data Model  assets for the entity

Configure settings required to make the entity available in the Common Data Model.

Task 6: Add the Contract case entity to the Data portal

Update the UI with the new fields added to the Contracts entity. Add a landing page for Contracts.

Note: Before performing this exercise, download the following file and extract the SQL scripts:
CH97361-1-EN-Adding-an-entity.zip

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Create and configure the Contract case type

  1. On the exercise system landing page, enter the following credentials:
    1. In the User name field, enter cdmadmin
    2. In the Password field, enter rules.
  2. In the navigation pane of Dev Studio, click Case types > Add a case type to create an entity.
  3. In the Name field, enter Contract, and then click Submit.
  4. Save the Contract case type.
  5. In the navigation pane of Dev Studio, click App, and then in the search field, enter Common-LDM-Entity.
  6. Expand Contract, right-click Data Model, and then select Create > Property.
  7. In the field Label, enter ContractID, and then click Create and open.
  8. In the Property type section, click change > Identifier, and then click Save.
  9. In the Application Explorer, expand Contract > SysAdmin > Class and then click Common-LDM-Entity-Contract to open the class record.
  10. In the Settings section, in This class list, select is a class group.
  11. In the Keys section, enter the following details:
    1. In the Name field, enter or select .ContractID.
    2. In the Caption field, enter Contract ID.
  12. Click Save.
  13. In the Application Explorer, expand Account > Data Model > Data Transform > pyDefault.
  14. Click Save > Specialize by class or ruleset.
  15. In the Data Transform Record Configuration section, complete the details:
    1. In the Label field, enter Sets default values for contract creation.
    2. In the Apply to field, enter or select Common-LDM-Entity-Contract.
  16. Click Create and open.
  17. In the Data Transform, update the following information:
    1. In the 1 row, in the Target field, replace account with contract.
    2. In the 2 row, in the Source field, enter or select "Cont-".
    3. In the 3 row, in the Target field, replace two instances of .AccountID with .ContractID.
    4. In the 3.1 row, in the Target field, replace .AccountID with .ContractID.
    5. In the row, in the Source field, replace .AccountID with .ContractID.
  18. Click Save.

2 Add the database tables for the Contract case type

  1. In the header of the exercise system landing page, click Application Switcher > pgAdmin.
  2. On the pgAdmin login page, enter the following credentials:
    1. In the Email Address / Username field, enter [email protected].
    2. In the Password field, enter install12345!.
  3. In the Browser pane, expand Servers > Postgres > Databases, and then click on pega.
  4. In the pgAdmin menu, click Tools > Query Tool.
  5. Copy the contents of the create-entity.sql file.
  6. In the Query section, paste the contents of the create-entity.sql file, and then click the Play icon to run the script.
  7. Repeat steps 5 to 6 for the create-entity-history.sql file.
  8. Return to the Pega application.
  9. In the header of Dev Studio, select Create > SysAdmin > Database Table.
  10. Populate the Create Database Table form:
    1. In the Database Table short description text box, enter Common-LDM-Entity-Contract.
    2. In the Class Name field, enter or select Common-LDM-Entity-Contract, and then click Create and open.
  11. Complete the Database form:
    1. In the Database field, enter or select PegaDATA.
    2. In the Table name field, enter common_contract.
    3. Click Save, and then click Test connectivity.
  12. Verify that the class maps to the data.common_contract table in PegaDATA.
  13. In the navigation pane of Dev Studio, click Records > SysAdmin > Database Table.
  14. In the Class Name column, click the Filter icon, enter History-Common-LDM-Entity-Contract, and then click Apply.
  15. Open the record.
  16. In the Table name field, enter common_hist_contract.
  17. Click Save, and then click Test connectivity.
  18. Verify that the class maps to the data.common_hist_contract table in PegaDATA.

3 Optimize and add fields to the Contract case type

  1. In the navigation pane of Dev Studio, click App.
  2. On the Classes tab, in the search field, enter Common, and then click Data Model > Property.
  3. Right-click RecordStatus, and then select Optimize for reporting.
  4. Select the Common-LDM-Entity-Contract checkbox, and then click Next.
  5. Click Next, and then Finish.
  6. In the Application Explorer, click LDM > Data Model > Property, and then for each of the following properties, right-click the property, select Optimize for reporting, and then repeat steps 4 and 5:
    • IndustryID
    • Origin
    • SampleID
    Note: If you get an error saying that a job is already scheduled or in progress, wait a minute or so and try again.
  1. In the Application Explorer, click LDM > Entity > Contract > Data Model > Property, select Optimize for reporting, and then repeat steps 4 and 5 for ContractID.
  2. In the navigation pane of Dev Studio, click Case types > Contract, and then click the Data model tab.
  3. Click Add field, and then configure the field:
    1. In the Field name field, enter Active on.
    2. In the Type list, select Date only, and then click Submit & add another.
    3. In the Field name field, enter Expire on.
    4. In the Type list, select Date only, and then click Submit.
  4. Click Save to save the data model changes.

4 Add indexes for the Contract database table

  1. Return to pgAdmin.
  2. In the Browser pane, expand Servers > Postgres > Databases, and then click pega.
  3. In the pgAdmin menu, select Tools > Query Tool.
  4. Copy the contents of the create-index.sql file.
  5. In the Query section, paste the contents fo the SQL file.
  6. Click the Play icon to run the script.

5 Configure Common Data Model assets for the entity

  1. Create property ContractEntityClass in Common-Admin-ApplicationSetting.
    1. In the Application Explorer, click Common > Admin > ApplicationSetting.
    2. Expand Data Model, then right-click > Property and click Create.
    3. In the Label field, enter ContractEntityClass and click Create and open.
    4. Click Save,
  2. Create class settings data transform for the TestApp: Common-Admin-ApplicationSetting.ClassSettings_TEST.
    1. In the Application Explorer, right click Common-Admin-ApplicationSetting > Data Model > Data Transform > ClassSettings and click Create.
    2. In the Label field, enter ClassSettings_TEST and click Create and open.
    3. In the first line, in the Action field, enter Set. 
    4. In the Target field, enter .ContractEntityClass.
    5. In the Source field, enter "Common-LDM-Entity-Contract".
    6. Click Save.
  3. In the Application Explorer, open Common > LDM > Entity > Location > Reports > Report definition, then select LocationList.

  4. Click Save as.
    1. In the Label field, enter ContractList,
    2. In the Applies to field, enter Common-LDM-Entity-Contract, and then click Create and open.
  5. On the ContractList report definition, change the following settings:
    1. On the Pages & Classes tab, change class to Common-LDM-Entity-Contract
    2. On the Parameters tab, replace LocationID with ContractID
    3. Complete the Query tab:
      1. Replace LocationID with ContractID
      2. Add columns for the ActiveOn and ExpireOn fields.
      3. Remove columns not used.
    4. Click Save.

6 Add the Contract entity to the Data portal

  1. Click Dev Studio > App Studio to switch workspaces.
  2. In the navigation pane of App Studio, click Case types > Contract, and then click the UX tab.
  3. Click Other views tab in the Form section, then to select the Create form, click Create.
  4. In the Fields section, click Add > Fields, and then select the following checkboxes:
    • Active on
    • Expire on
  5. Click Add, and then click Save.
  6. In the navigation pane, click Back to return to the Other views tab.
  7. in the Lists section, click List.
  8. In the Columns section, click Add, and then select the following checkboxes:
    • Active on
    • Expire on
  9. Click Add, and then click Save.
  10. In the navigation pane of App Studio, click Channels > Data Portal > Landing pages.

  11.  Click Add, and then edit the landing page:

    1. In the Name field, enter Contract, and then click Submit.
    2. Select Use existing lists.
    3. In the List view field, select Contract – List, and then click Save.
    4. In the navigation pane, click the Back arrow, and then click Main navigation.
    5. In the Landing pages section, click Add item > Contracts, and then click Save.

 

Confirm your work

  1. In the header of App Studio, click Preview, then Add > Contract.
  2. Enter the following information in the New Contract form:
    1. In the Label field, enter Test contract.
    2. In the Description, enter Verify that we can add a contract.
    3. In the Active on field, enter 06/01/2024.
    4. In the Expire on field, enter 06/01/2025.
  3. Click Submit.
  4. In the navigation pane of the Data Portal, open the Contract landing page, and verify that the contract you created is displayed in the list.

This Challenge is to practice what you learned in the following Module:


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

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 Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice