Skip to main content

Challenge

Adding an entity

Adding an entity

6 Tasks

20 mins

Visible to: All users Applies to: Pega Customer Service '24.2
Advanced
English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Scenario

After reviewing the Common Data Model, you concluded that you must extend it with an entity for contract data. Based on the requirements of your organization, you decide to add an entity called Contract, 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 cssystemadmin password123!

Your assignment consists of the following tasks:

Task 1: Create and configure the Contract case type

Use the Case Types explorer to add the Contract entity, create the field ContractID, and the pyDefault Data Transform, and configure them for the Contract 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 Contract 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 that are specific to the Contract entity.

Task 4: Add indexes 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 the required settings for the entity.

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

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

Note: Before performing this exercise, download the following file and extract the SQL scripts:
CH97361-2-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.

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 cssystemadmin
    2. In the Password field, enter password123!
  2. Set the default work pool.
    1. In the navigation pane of Dev Studio, click Records > Security > Access Group.
    2. On the Access Group page, open your access group: CSApp:Admin
    3. On the Advanced tab, in the Name field of the section, add  Common-LDM-Entity, and set it as the default.
      Set default work pool
      Set default work pool
    4. Click Save.
    5. Log out, then log back in for this change to take effect.
  1. In the navigation pane of Dev Studio, click Case types > Add a case type to create an entity.
  2. In the Name field, enter Contract, and then click Submit.
    Note: Dev Studio creates associated rules and then displays the Contract case type. This may take a few minutes.
  1. In the navigation pane of Dev Studio, click App, and then in the search field, enter Common-LDM-Entity.
  2. Expand Contract, right-click Data Model, and then select Create > Property.
  3. In the Label field, enter ContractID, and then click Create and open.
  4. In the Property type section, click change > Identifier, and then click Save.
  5. In the Application Explorer, expand Contract > SysAdmin > Class and then click Common-LDM-Entity-Contract to open the class record.
  6. In the Settings section, in This class list, select is a class group.
  7. 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.
  8. Click Save.
  9. In the Application Explorer, expand Account > Data Model > Data Transform, and then select pyDefault.
  10. Click Save > Specialize by class or ruleset.
  11. 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.
  12. Click Create and open.
  13. 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 6 row, in the Source field, replace .AccountID with .ContractID.
  14. 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 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 and 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 expand 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 click Finish.
  6. In the Application Explorer, expand LDM > Data Model > Property, and then repeat steps 4 and 5 for the following properties:
    • 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, 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 changes to the Data Model.

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 of the SQL file.
  6. Click the Play icon to run the script.

5 Configure Common Data Model assets for the entity

  1. Create the ContractEntityClass property in Common-Admin-ApplicationSetting:
    1. In Dev Studio, in the Application Explorer, click Common > Admin > ApplicationSetting.
    2. Expand Data Model, right-click Property, and then click Create.
    3. In the Label field, enter ContractEntityClass, and then click Create and open.
    4. Click Save.
  2. Create the class settings Data Transform for the CSApp: Common-Admin-ApplicationSetting.ClassSettings_CSApp:
    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_CSApp, and then 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, expand 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:
  6. On the Pages & Classes tab, change the class to Common-LDM-Entity-Contract
  7. On the Parameters tab, replace LocationID with ContractID
  8. Complete the Query tab:
    1. Replace LocationID with ContractID
    2. Add columns for the ActiveOn and ExpireOn fields.
    3. Remove the unused columns.
  9. 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, and then in the Form section, select Create to open the Create form.
  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 List section, click Contract 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 Contracts, 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.


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