Skip to main content

Manipulating application data

Archived

2 Tasks

20 mins

Visible to: All users
Beginner
Pega Platform 8.6
Data Integration
English
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded. Click here to continue your progress in the latest version.

Scenario

To ensure that customers are billed for only the services provided, the program manager wants the application to display a list of the services performed by the service provider. The list must include the following information: the name of the service performed, the unit cost of the service, the number of times the service was performed, the total cost for each service, and the total cost of the services performed. On the Perform service flow, configure the CopySelectedServices data transform to copy services provided from a Service case to an Assistance request case.

The following diagram displays the relationships of the Selected services Embedded data type in the Assistance Request case type, and the Services data relationship in the Service case type to the Services offered data type.

entity relationship diagram services offered

The following table provides the credentials you need to complete the challenge.

Role User name Password
Application Developer author@gogoroad pega123!
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.

Challenge Walkthrough

Detailed Tasks

1 Configure the Review service summary step

  1. In the navigation pane of App Studio, click Case types > Assistance Request to open the Assistance request case type.
  2. In the Assistance request case type, on the Workflow tab, click Review service summary to open the step properties pane.
  3. In the step properties pane to the right, click Configure view to display a dialog box.
  4. In the dialog box, click Add field to configure a new field.
  5. Create a multi-record data relationship named Selected services. In the Type list, select Embedded data. In the Data object list, select Services offered. Click the List of records radio button to designate it as a multi-record data relationship. 
    selected-services
  6. Click Submit & add another to configure a new field.
  7. Create a currency calculated field named Invoiced total. In the Type list, select Currency. Expand the Advanced section and check This is a calculated field (read-only). Under Calculation, select Sum of in the Function dropdown and Line total for the Field dropdown and click Submit.
    Invoiced total field configuration
  8. Click Submit to record the new fields and return to the Workflow tab of the case life cycle.
  9. Click Save to save your changes in the case life cycle.

2 Configure the CopySelectedServices data transform

  1. In the navigation pane of App Studio, click Case types > Service to open the Service case type.
  2. In the Perform service process, click Configure Process.
  3. Click Open process in Dev Studio to open the Perform service flow record in the flow canvas.
  4. In the flow canvas, right-click the Select services connector, and then select View Properties to display the Connector properties dialog box.
     
    Select services connector View properties
  5. In the Connector properties dialog box, in the Set properties area, select Apply data transform to add a data transform to the connector.
  6. In the Data transform field, enter CopySelectedServices to name the data transform. 
    connector properties CopySelectedServices data transform
  7. To the right of the Data transform field, click the Open icon to open the Create Data Transform tab.
  8. On the Create Data Transform tab, click Create and open to display a new data transform record.
  9. On the Definition tab of the data transform record, configure the CopySelectedServices data transform.
    1. On the data transform record, in the Action list, select For Each Page In to iterate over the items in a list. A second, indented row labeled 1.1 is displayed on the record.
    2. In the row labeled 1, in the Target field, enter or select .Services to iterate over the items in the Services list.
    3. In the Source column, select the Also use each page as source context check box to use the Services page as the source context to resolve property references.
    4. In the row labeled 1.1, in the Actions list, select When to configure the condition for selecting a row. A third, indented row labeled 1.1.1 is displayed on the record.
    5. In the row labeled 1.1, in the Target field, enter .Quantity>0 to only select rows with a quantity greater than zero.
    6. In the row labeled 1.1.1, from the Actions list, select Append to to append the contents of the selected row to a different list.
    7. In the row labeled 1.1.1, in the Target field, enter pyWorkCover.SelectedServices to copy the contents of the selected row to the Selected Services data relationship in the Assistance request parent case.
    8. In the row labeled 1.1.1, from the Relation list, select current source page to copy the contents of the selected row in the Services data relationship in the Service case. 
      data-transform
    9. On the data transform record, click the Pages & Classes tab to define the pyWorkCover page so that the data transform can resolve the Selected services property reference.
    10. In the Page name field, enter pyWorkCover as the name of the page to define.
    11. In the Class field, enter or select GoGo-GoGoRoad-Work-AssistanceRequest to define the context of the pyWorkCover page as the Assistance Request case type class. 
      page-classes
    12. Click Save to complete the configuration of the data transform.
  10. Click the PerformService tab to return to the Perform service flow record.
  11. In the Connector properties dialog box, click Submit to complete the configuration of the Select services connector that runs the CopySelectedServices data transform.
  12. Click Save to complete the configuration of the Perform service flow record.

Confirm your work

  1. In the header of Dev Studio, click Create > New > Assistance Request to create a new case.
  2. Advance the case to the Service stage.
    Note: In Enter customer information step, select a customer with standard coverage.
  3. On the Select service provider view, select a service provider.
  4. On the Select services view, enter the quantities provided in the following image.
  5. Verify that the total cost is $210.00. 
    selected-services
  6. Click Submit to complete the Select services assignment and resolve the Service case. The Review service summary view is displayed.
  7. On the Review service summary view, verify that the Selected services table displays the three rows filled out in the Service case and that the value of the Invoice total field is $210.00.
    Note: In a real-life implementation, ensure that the list of selected services in the Assistance Request case is read-only and restricts users from adding or removing items. You can remove the Add item and Delete controls by editing the section rule that displays the list, which is outside the scope of this challenge.
    reviewServices
Note: The empty first row in the table is a result of the Selected services list initialization. You can remove the empty first row by deleting the .SelectedServices(1).pyLabel created by default in the pySetFieldDefaults data transform, which is outside the scope of this challenge.


Available in the following missions:

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