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 | TestAppAdmin | 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 App Studio, 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.
Optional: Edit the Contacts view to show external data in the summary
When using an external data source, the summary data is not populated automatically. You can make changes to this view.
Challenge Walkthrough
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 TestAppAdmin.
- In the Password field, enter password123!.
- In the navigation pane of App Studio, start the designer tool.
- Click Tools > Data and Integration Designer.
- Click Launch Designer Tool.
- In the Choose entity section, click Reuse from an existing entity, then select Contact, and then click Next.
The Designer displays the Extend the Model stage.
- At the top of the page, click the Manage integration stage.
- Configure the source details:
- In the Select profile section, select the Contact Data Page.
- In the Profile list, select CONTACT_DETAIL, and then click Next.
- In the Source details section, under Select Connector, click Create Connector.
- In the Modification type list, select Replace connector.
- Click Next.
- 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 Next.
- 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 Next.
- In the Visual mapper, click the Request tab, and then to the left of the ContactId parameter, select Parameter.
- 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 Next.
- On the Review and save page, click Create. The Designer asks if you want to configure an additional profile.
- Click No and then select Next. The Designer displays the Review configuration 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 Data Transform section, click Response Data Transform, 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 Data Transform section, click Response Data Transform, 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 the response data transform.
- Click Next.
- 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 Next. The Designer displays the Case Summary.
- Click Resolve.
Note: The Data and 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 header of Dev Studio, click Launch portal > Data Portal.
- In the left navigation of the Data Portal, click Contacts.
- Select any contact.
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, then from the AddressList field, select AddressLine1, AddressLine2, City, Region or state code, Postal code.
- 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?