Skip to main content

Integrating an external data source

7 Tasks

25 mins

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

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 User name Password
Application Administrator cdmadmin rules

Your assignment consists of the following tasks:

Task 1: Configure a REST Connector for the external data

Run the REST integration wizard to connect to the external data source.

Task 2: Save the Data Page to your application Ruleset

Create a copy of the Contact Data Page in your application Ruleset.

Task 3: Save the response Data Transform to your application Ruleset

Create a version of the Response Data Transform in your application ruleset.

Task 4: Save the request Data Transform to your application Ruleset

Create a version of the Request Data Transform in your application Ruleset and modify the Applies to field to reference the REST service for the external data.

Task 5: Update the Data Page to reference the external source

Modify the D_Contact page in your application Ruleset to reference the external REST source.

Task 6: Update the data transform to map the response data

Modify the Response Data Transform to map data from the external source to your application.

Task 7: View the external data

Call the REST service and process the response.

 

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 Configure a REST Connector for the external data

Run the REST integration wizard to connect to the external data source.

  1. On the exercise system landing page, click Launch Pega Infinity™ , and then log in as an Administrator by entering the following credentials:
    1. In the User name field, enter cdmadmin.
    2. In the Password field, enter rules.
  2. In the header of Dev Studio, click Configure > Integration > Connectors > Create REST Integration to run the New REST Integration wizard.
  3. In the System details section, enter the following connection details:
  4. In the Name field, enter ExternalCon.
  5. In the Endpoint URL field, enter http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/123/.
  6. In the Authentication section, click Add authentication to configure the authentication service:
    1. Select Define New.
    2. In the User name field, enter serviceuser.
    3. Click Set password, and then enter password123!.
    4. Click Submit.
  7. Click Next to configure the resource methods.
  8. In the Resource Name field, enter ExternalCon, and then click Next to configure the Data Model. This is the identifier you use to identify the REST resource in the Contact Data Page.
  9. On the Data Model page, click Add a REST response.
  10. In the Add a REST response dialog box, click Run to query the service and get a JSON response.
  11. Click Submit to save the Data Model.
  12. Click Next to review the configuration.
  13. In the Data Layer section, select Skip (I'll do it later), and then click Create to create the REST connector.
    You do not need a new data layer, as you integrate the REST Connector with an existing data layer.
  14. Wait for the generation to complete, and then click Close.

2 Save the Data Page to your application Ruleset

Create a copy of the Contact Data Page in your application ruleset.

  1. In the navigation pane of Dev Studio, click App, and then in the search field, enter Common-LDM-Entity.
  2. Expand Contact > Data Model > Data Page.
  3. In the Data Explorer, open the D_Contact Data Page.
  4. Click Save as, and then on the new page, maintain the default context settings:

    Setting

    Value

    Context

    TestApp

    Apply to

    Common-LDM-Entity-Contact

    Add to ruleset

    TestApp:01-01-01

  1. Click Create and open, and then click Save.

3 Save the response Data Transform to your application Ruleset

Create a version of the Request Data Transform in your application Ruleset and modify the Applies to field to reference the REST service for the external data.

  1. In the App Explorer, expand Contact > Data Model > Data Transform.
  2. Open the Con_Detail_Response Data Transform.
  3. Click Save as.
  4. In the Identifier field, click Edit, and then change the identifier to ExternalCon_Detail_Response.
  5. On the new page, set the Context settings:

    TestApp

    Applies to: Common-LDM-Entity-Contact

    Ruleset: TestApp:01-01-01

  1. Click Create and open, and then click Save.

4 Save the request Data Transform to your application Ruleset

Create a version of the Request Data Transform in your application ruleset and modify the Applies to field to reference the REST service for the external data.

  1. In the navigation pane of Dev Studio, click App, and then in the search field, enter Common-LDM-Entity.
  2. In the App Explorer, expand Contact > Data Model > Data Transform.
  3. Open the Con_Detail_Request Data Transform.
  4. Click Save as.
  5. In the Identifier field, click Edit, and then change the identifier to ExternalCon_Detail_Request.
  6. In the Context section, in the Apply to field, enter Common-Admin-Int-External-ExternalConAPI.
  7. Click Create and open, and then click Save.
  8. Click the Pages & Classes tab and change the ConnectorPage class to Common-Admin-Int-External-ExternalConAPI
  9. Complete the Definition tab:
    1. In row 3, in the Target field, enter connectorPage.request.ContactId.
      Use lowercase "d" in "Id" to map to the external data.
    2. In row 4.1, in the Target field, enter connectorPage.request.Contact.ContactID to map the contact ID to the external source.
    3. Click Save.

5 Update the data page to reference the external source

Modify the D_Contact Data Page in your application ruleset to reference the external REST source.

  1. In the App Explorer, open the D_Contact Data Page.
    This Data Page is the version saved to the TestApp:01-01-01 Ruleset.
  2. In the Data Sources section, under Profile_Con_Detail, enter the external data source information:
    1. In the Source list, select Connector.
    2. In the Type list select REST.
    3. In the Name field, enter ExternalCon. This is the ConnectorName that calls the Data Transforms using the naming convention: ConnectorName_Method_Request and ConnectorName_Method_Response.
    4. In the Endpoint URL field, enter http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/123.
    5. In the Method list, select GET.
  3. Click Save to save the D_Contact Data Page.

6 Update the data transform to map the response data

Modify the Response Data Transform to map data from the external source to your application.

  1. In the navigation pane of Dev Studio, select App, and then in the search field, enter Common-LDM-Entity.
  2. Expand Contact > Data Model > Data Transform.
  3. In the App Explorer, open the ExternalCon_Detail_Response Data Transform. If you do not see the Data Transform in the list, scroll to the top of the App Exlporer and from the menu, select Refresh App Explorer.
  4. Click the Pages & Classes tab, and then change the ConnectorPage class to Common-Admin-Int-External-ExternalConAPI.
    Use the API class because it contains the request and response properties. The response property contains the values from the REST service after you call it.
  5. On the Definition tab, modify row 2:
    1. In the Relation column, select with values from.
    2. In the Source column, enter connectorPage.response_GET.
  6. Click Save.
  7. Click Add a row to map the following Target fields to the Source fields for the following properties to map fields from the external source:

    Target

    Source

    .ContactID

    connectorPage.response_GET.ContactId

    .FirstName

    connectorPage.response_GET.FirstName

    .LastName

    connectorPage.response_GET.LastName

    .PrimaryAddress.Line1

    connectorPage response_GET.AddressLine1

    .PrimaryAddress.Line2

    connectorPage response_GET.AddressLine2

    .City

    connectorPage.response_Get.City

    .State

    connectorPage.response_GET.State

    .PrimaryAddress.PostalCodeID

    connectorPage.response_GET.Zip

  1. To add a page for the Phone List, click Add a row and configure the following:
    1. In the Action list, select Append and map to.
    2. In the Target field, enter .PhoneList.
    3. In the Relation list, select a new page.
    4. In the second-level row, in the Target field, enter connectorPage.response_GET.MobilePhone.
    5. Right-click the second level row, and then select Add sibling below.
    6. Configure a set action where .IsPrimary is equal to "true".
  2. To add a page for the Email List, click Add a row and configure the following:
    1. In the Action list, select Append and map to.
    2. In the Target field, enter .EmailList.
    3. In the Relation field, select a new page.
    4. In the second-level row, in the Target field, enter connectorPage.response_GET.Email.
    5. Right-click the second level row, and then select Add sibling below.
    6. Configure a set action where .IsPrimary is equal to "true".
  3. Click Save to save your changes to the ExternalCon_Detail_Response Data Page.

7 View external data

Now that all the pieces are in place, it is time to call the REST service and process the response.

  1. Open the D_Contact Data Page, then click Actions > Run.
  2. In the Run Data dialog box, in the ContactID field, enter ContactId, and then click Run.
    The dialog box shows the properties for the Pat Smith contact.
  3. Work around a display error in the Data Portal by refreshing the cache:
    1. Open the D_Contact Data Page, and then click the Parameters tab.
    2. Select the Is this page used for alternate key storage? checkbox.
    3. In the ContactID parameter, in the Linked field, enter ContactId.
    4. Click Save to save the Data Page.
    5. In the navigation pane, click Case Types > Contact.
    6. Click the Settings tab, and then click Default data sources.
    7. In the Default record lookup data page list, select None.
    8. Click Save.
    9. Click Default data sources.
    10. In the Default record lookup data page list, select Contact.
    11. In the Profile list, select Constant, and then enter CONTACT_DETAIL.
    12. Click Save.
  4. In the header of Dev Studio, click Launch Portal > Data Portal.

In the navigation pane, click Contacts, then select any contact in the list.
The contact details now show the data from the external source.


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