Integrating an external data source
3 Tasks
25 mins
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 used by the Contact entity.
The following table provides the credentials that you need to complete the challenge:
| Role | User name | Password |
|---|---|---|
| Application Administrator | CSSystemAdmin | password123! |
Your assignment consists of the following tasks:
Task 1: Use the Data and integration designer to configure the connector to external data and map the response data
In the Data Portal, run the Data and integration designer to connect to the external data source and map the response data to the Contact entity.
Task 2: View the external contact data
Call the REST service and process the response.
Detailed Tasks
1 Use the Data and Integration Designer to configure the connector to external data and map the response data
- In the Pega instance for the challenge, click Launch Pega Infinity™ , and then log in as an Administrator by entering the following credentials:
- In the User name field, enter CSSystemAdmin.
- In the Password field, enter password123!.
- In the header of Dev Studio, click Launch Portal > Data Portal.
- In Data Portal, click Create > Data and integration designer.
- In the Create Data and integration designer dialog box, configure your entity:
- In the Choose an option section, select Existing entity,
- In the Select entity section, click Contact.
- In the Select an action section, select Integrate with Data sources.
- Click Submit.
- Configure the source details:
- In the Select profile section, click Go, and then select the Contact Data Page.
- In the Profile list, select CONTACT_DETAIL, and then click Submit.
- In the Source details section, in the Select Source Connector section, click New.
- In the Source type list, select REST, and then select Replace.
- Click Continue.
- Configure the connection details:
- In the System Name field, enter ExternalCon.
- In the Resource Name field, enter Con1.
- In the Endpoint URL field, enter http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/ContactId
- In the Resource path parameters, select the ContactId parameter.
- In the Authentication section, click Add authentication to configure the authentication service.
- Select Define New.
- In the User name field, enter serviceuser.
- Click Set password, enter password123!, and then click Submit.
- Click Continue.
- Configure the request response:
- Click Add a REST response.
- In the ContactId parameter, enter ContactId, and then click Run.
Note: The dialog box displays the data for the contact named Pat Smith. This is the one contact in our external data source.
- Click Submit, and then click Continue.
- In the Visual mapper, click the Request tab, and then to the right of the ContactId parameter, select Key.
- In the Visual mapper, map the base properties.
- Click the Response tab, and map the Source fields to the Target fields for the following properties:
Source
Target
FirstName
.FirstName
LastName
.LastName
ContactId
.ContactId
- Click Continue.
- On the Review and save page, click Finish. The Designer displays the Configure mapping page. If you get a page error, refresh the browser page, and then click Go to display the Configure mapping page.
- Click the Response tab, and map the Source fields to the Target fields for the following properties:
- Map the Page properties for primary address.
- In the Configure the mapping section, click Response mapping, The Edit Data Transform page shows the three fields entered earlier: .FirstName, .LastName, .ContactID
Note: When mapping properties on the Edit Data Transform page, if you delete an entry, click Save to save your changes. You will see an error message. Refresh the page to continue to add entries.
- Click Add element, then select the Action named Append and map to. In the Clipboard field, enter .AddressList; in the Relation field, select An array of objects.
- Add subentries for the following .AddressList properties. Click Add element to add each field.
Clipboard
Source JSON
.Line1
AddressLine1
.Line2
.AddressLine2
.City
City
.RegionID
State
.PostalCodeID
Zip
- Collapse the .AddressList entries.
- In the Configure the mapping section, click Response mapping, The Edit Data Transform page shows the three fields entered earlier: .FirstName, .LastName, .ContactID
- Map the Page list property for phone number.
- Click Add element, then select the Action named Append and map to. In the Clipboard field, enter .PhoneList; in the Relation field, select An array of objects.
- Under .PhoneList, add a subentry with Clipboard value .PhoneNumber and Source JSON value MobilePhone.
- Collapse the .PhoneList entry.
- Map the Page list property for email address.
- Click Add element, then select the Action named Append and map to. In the Clipboard field, enter .EmailList; in the Relation field, select An array of objects.
- Under .EmailList, add a subentry with Clipboard value .Email and Source JSON value Email.
- Click Save.to close the Edit Data Transform page.
- In the Configure the mapping section, click Submit.
- At the top of the Case, click the Test Entity Stage.
- In the Run entity section, in the ContactID field, enter ContactId, and then click Run Data Page.
Note: The page displays the properties for the Pat Smith contact.
- Click Submit. The Designer displays the Case Summary.
- Click Resolve.
Note: The Data Integration Designer completes integration of the data source and resolves the Case.
2 View the external contact data
You can now view the data from the external source in your Contacts.
In the navigation pane of the Data Portal, click Contacts, and then select any contact in the list.
The contact details now show the data from the external source
3 Optional: Edit the Contacts view to show the external data in the summary
When you view a contact, the summary can show basic information such as the contact name, address, email address, and phone number. As we are using an external data source, the summary data is not populated automatically. You can make changes to this view.
- In the header of Dev Studio, click Dev Studio > App Studio to switch the application.
- In the left navigation of App Studio, click Data, then scroll down and click Contact.
- In the Contact data object, click the UX tab.
Note: The UX tab shows the layout of fields for the views that display a Contact in the Data Portal.
- In the Heading field, select Last name.
- In the Subheading field, select Contact ID.
- In the Highlighted fields section, click Add and then select the following fields: First name, Last Name, AddressLine1, AddressLine2, City, State, Zip.
- Click Add to add the fields to the Full View.
- Click Save.
- In the header of App Studio, click App Studio > Dev Studio to switch applications.
- In the header of Dev Studio, click Launch portal > Data Portal.
- In the left navigation of the Data Portal, click Contacts.
- In the list of contacts, click any contact to display the full view.
The Summary shows the external data you configured for the view: Last name and Contact ID in the heading; First and Last name and address in the highlighted fields.
Available in the following mission:
Want to help us improve this content?