Skip to main content

Integrating external customer service data

Archived

6 Tasks

30 mins

Visible to: All users
Beginner Pega Customer Service 8.5 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

A REST service has been created to access contact data for a customer. Your task is to access that data to replace the sample data.  

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

Role

 

Username

Password

System Architect

 

CASysAdmin

rules

REST service user

 

serviceuser

rules

Your assignment consists of the following tasks:

Task 1: Observe the out of the box configuration

Using the system architect login, open the Interaction Portal and run through an interaction with Sara Connor and observe her contact information.

Task 2: Create the data class

Create a new data class, named MyContact, to represent the external data. Make sure the class inherits from PegaCA-Interface-Contact.

Task 3: Configure the REST Connector

Run the REST Connector wizard to create the classes needed to access the REST service.

  • Use the REST service user credentials
  • The URL of the REST service is: http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/{ContactId}

Task 4: Create a data transform

Create a data transform to map the properties from the REST service to the MyContact data class. Save the data transform as part of the MyContact class.

Task 5: Use the REST Connector in an activity

Update the load activity in the Contact details data page.

    • Comment out or delete the current step to load data in the activity.
    • Add a page for the REST service.
    • Configure the contact ID for the request in the REST service.
    • Call the REST connector you created using the REST service page.
    • Call the data transform you created to map the data in the response to your data class.

Task 6: Confirm your work

Run an interaction again and observe that the new data is used. 

Challenge Walkthrough

Detailed Tasks

1 Observe the out of the box configuration

  1. Log in to your exercise environment as user name casysadmin with password rules.
  2. Click Launch web interface > Interaction portal to open the Interaction portal.
    Note: The Interaction portal opens in a separate browser window. If you do not see it, check your pop-up blocker.
  1. Click New > Demo Screen Pops > Demo Pop – CONNOR to start an interaction with Sara Connor.
  2. Click Accept to start the call.
  3. In the header, notice the contact information looks like the following screen shot.
    sara information
  4. Click Wrap up and then Submit to finish the interaction.
  5. Close the browser that contains the Interaction Portal.

2 Create the data class

  1. In Dev Studio, click Data types.
  2. Click down arrow > Add data type to create a new data type.
    add date type
  3. In the Label field, enter MyContact
  4. Expand the Advanced section and make the following changes:
    1. Set Choose app layer to: Customer Service 8.5
    2. Set Add to ruleset to PegaCS-Sample.
  5. Click Submit to create the MyContact data type.
  6. From the Data types list, hover over MyContact, click the menu icon, and select View definition.
  7. Update the Parent class to PegaCA-Interface-Contact.
  8. Click Save to update your data class.
  9. Go to the CPMInterfaceLayerSettings:
    1. Click App Explorer
    2. Search for PegaCA-Admin-ApplicationSetting
    3. Expand Data Model
    4. Expand Data Transform
    5. Select CPMInterfaceLayerSettings
  10. Locate the .InterfaceContactClass setting and update the value to PegaCA-Data-MyContact.
  11. Click Save as to save the CPMInterfaceLayerSettings to your application.
  12. In the Context field:
    1. Add to ruleset: PegaCS-Sample
    2. Version: 08-05-02
  13. Click Create and open.
  14. Click Save to save your changes.
  15. Click Check in to check in your new rule.

3 Configure the REST Connector

  1. In Dev Studio, click Configure > Integration > Connectors > Create REST Integration to run the Integration wizard.
  2. Enter the following connection details:
    1. Name: ExternalContactData
    2. Endpoint URL: http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/{ContactId}
  3. Click Add Authentication to configure the Authentication to the service:
    1. Select Define New.
    2. User name: serviceuser
    3. Password: rules
  4. Click Next to configure the Resource methods.
  5. Name the method GET_ExternalContactData.
  6. Click Next to configure the data model.
  7. Click Add a REST Response.
  8. Click Run to query the service and get a JSON response.
  9. Click Submit to save your data model.
  10. Click Next to review the configuration.
  11. Click the pencil icon and update the Context of the Integration layer and when finished, click Submit.
    1. Select Existing.
    2. Ruleset: PegaCS-Sample
    3. Version: 08-05-02
  12. Click the pencil icon and update the Context of the data layer and when finished, click Submit.
    1. Select Existing.
    2. Ruleset: PegaCS-Sample
    3. Version: 08-05-02
  13. Click Create to generate the REST connector.

4 Create a data transform

  1. Click Create > Data Model > Data Transform to create a new data transform that maps the REST response to the MyContact data class.
  2. Configure the data transform using the following properties and then click Create and Open.
    1. Label: MapRESTResponse
    2. Apply To: PegaCA-Data-MyContact
  3. Click the Pages & Classes tab.
  4. Add a Page with the following details:
    1. Page name: RESTService
    2. Class: CPM-Int-External-GET_ExternalContactDataAPI
  5. Click the Definition tab to configure the data transform.
  6. Complete the data transform and map the following properties to their corresponding properties from the response in the RESTService.
    1. .FirstName – RESTService.response_GET.FirstName
    2. .LastName - RESTService.response_GET.LastName
    3. .AddressLine1 - RESTService.response_GET.AddressLine1
    4. .AddressLine2 - RESTService.response_GET.AddressLine2
    5. .City - RESTService.response_GET.City
    6. .StateCode - RESTService.response_GET.State
    7. .ZipCode - RESTService.response_GET.Zip
    8. .PrimaryEmail - RESTService.response_GET.Email
    9. .PrimaryPhoneNumber - RESTService.response_GET.MobilePhone
    10. .ContactId - RESTService.response_GET.ContactId
  7. Click Save to save your data transform.

5 Use the REST Connector in an activity

  1. To access the Contact data type, click App Explorer and search for PegaCA-Interface-Contact.
  2. Expand Data Model, then expand Data Page, and then select D_Contact_Details to update the Contact details data page.
  3. Click Save as to save a copy of the data page to your ruleset.
    1. In the Apply to field, enter PegaCA-Data-MyContact
    2. In the Add to ruleset field, enter PegaCS-Sample and version 08-05-02.
    3. Click Create and open to create the new data page.
  4. To the right of DPLoadContact, click the crosshairs to open that Activity.
  5. Click Save as to save a copy to your ruleset.
    1. In the Apply to field, enter PegaCA-Data-MyContact
    2. In the Add to ruleset, enter PegaCS-Sample and version 08-05-02.
    3. Click Create and open to create the new activity.
  6. Click the Pages & Classes tab to update the pages used in the activity.
  7. In the Class field, change the AppContact class to PegaCA-Data-MyContact to reflect your data class.
  8. Click the Plus icon to add a new page and use the following details:
    1. Page name: RESTService
    2. Class: CPM-Int-External-GET_ExternalContactDataAPI
  9. Click the Steps tab and, in the Label field for the Call AppReadContactInfo step, enter //. This comments out the existing Call to the sample data.
  10. Click Add a step to configure a new Page-New step with the following details:
    1. Method: Page-New
    2. Step page: RESTService
  11. Click Add a step to configure a new Property-Set step with the following details:
    1. Method: Property-Set
    2. Step Page: RESTService
  12. Expand the new Property-Set step and configure it to set the contact ID in the request object for the REST service.
    1. PropertiesName: .request.ContactId
    2. PropertiesValue: Param.ContactId
  13. Click Add a step to configure a new Connect-REST step with the following details:
    1. Method: Connect-REST
    2. Step Page: RESTService
  14. Expand the Connect-REST step and set the ServiceName to GET_ExternalContactData.
  15. Click Add a step to configure a new Apply-DataTransform step to with the following details:
    1. Method: Apply-DataTransform
    2. Step Page: AppContact
  16. Expand the Apply-DataTransform step and set the DataTransform to MapRESTResponse.
  17. Save and Check In your activity.

6 Confirm your work

  1. Click Launch web interface > Interaction Portal to open the Interaction Portal.
  2. Click New > Demo Screen Pops > Demo Pop – CONNOR to start an interaction with Sara Connor.
  3. Click Accept to begin the call. Observe that the call is now from Pat Smith.
  4. In the header, notice the contact information now displays the details for Pat Smith.
  5. Click Wrap up and then Submit to finish the interaction.
  6. Close the browser that contains the Interaction Portal.


Available in the following mission:

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