Integrating external customer service data
Archived
6 Tasks
30 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.
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
- Log in to your exercise environment as user name casysadmin with password rules.
- 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.
- Click New > Demo Screen Pops > Demo Pop – CONNOR to start an interaction with Sara Connor.
- Click Accept to start the call.
- In the header, notice the contact information looks like the following screen shot.
- Click Wrap up and then Submit to finish the interaction.
- Close the browser that contains the Interaction Portal.
2 Create the data class
- In Dev Studio, click Data types.
- Click down arrow > Add data type to create a new data type.
- In the Label field, enter MyContact
- Expand the Advanced section and make the following changes:
- Set Choose app layer to: Customer Service 8.5
- Set Add to ruleset to PegaCS-Sample.
- Click Submit to create the MyContact data type.
- From the Data types list, hover over MyContact, click the menu icon, and select View definition.
- Update the Parent class to PegaCA-Interface-Contact.
- Click Save to update your data class.
- Go to the CPMInterfaceLayerSettings:
- Click App Explorer
- Search for PegaCA-Admin-ApplicationSetting
- Expand Data Model
- Expand Data Transform
- Select CPMInterfaceLayerSettings
- Locate the .InterfaceContactClass setting and update the value to PegaCA-Data-MyContact.
- Click Save as to save the CPMInterfaceLayerSettings to your application.
- In the Context field:
- Add to ruleset: PegaCS-Sample
- Version: 08-05-02
- Click Create and open.
- Click Save to save your changes.
- Click Check in to check in your new rule.
3 Configure the REST Connector
- In Dev Studio, click Configure > Integration > Connectors > Create REST Integration to run the Integration wizard.
- Enter the following connection details:
- Name: ExternalContactData
- Endpoint URL: http://localhost:8080/prweb/PRRestService/test/01-01-01/getContactData/{ContactId}
- Click Add Authentication to configure the Authentication to the service:
- Select Define New.
- User name: serviceuser
- Password: rules
- Click Next to configure the Resource methods.
- Name the method GET_ExternalContactData.
- Click Next to configure the data model.
- Click Add a REST Response.
- Click Run to query the service and get a JSON response.
- Click Submit to save your data model.
- Click Next to review the configuration.
- Click the pencil icon and update the Context of the Integration layer and when finished, click Submit.
- Select Existing.
- Ruleset: PegaCS-Sample
- Version: 08-05-02
- Click the pencil icon and update the Context of the data layer and when finished, click Submit.
- Select Existing.
- Ruleset: PegaCS-Sample
- Version: 08-05-02
- Click Create to generate the REST connector.
4 Create a data transform
- Click Create > Data Model > Data Transform to create a new data transform that maps the REST response to the MyContact data class.
- Configure the data transform using the following properties and then click Create and Open.
- Label: MapRESTResponse
- Apply To: PegaCA-Data-MyContact
- Click the Pages & Classes tab.
- Add a Page with the following details:
- Page name: RESTService
- Class: CPM-Int-External-GET_ExternalContactDataAPI
- Click the Definition tab to configure the data transform.
- Complete the data transform and map the following properties to their corresponding properties from the response in the RESTService.
- .FirstName – RESTService.response_GET.FirstName
- .LastName - RESTService.response_GET.LastName
- .AddressLine1 - RESTService.response_GET.AddressLine1
- .AddressLine2 - RESTService.response_GET.AddressLine2
- .City - RESTService.response_GET.City
- .StateCode - RESTService.response_GET.State
- .ZipCode - RESTService.response_GET.Zip
- .PrimaryEmail - RESTService.response_GET.Email
- .PrimaryPhoneNumber - RESTService.response_GET.MobilePhone
- .ContactId - RESTService.response_GET.ContactId
- Click Save to save your data transform.
5 Use the REST Connector in an activity
- To access the Contact data type, click App Explorer and search for PegaCA-Interface-Contact.
- Expand Data Model, then expand Data Page, and then select D_Contact_Details to update the Contact details data page.
- Click Save as to save a copy of the data page to your ruleset.
- In the Apply to field, enter PegaCA-Data-MyContact
- In the Add to ruleset field, enter PegaCS-Sample and version 08-05-02.
- Click Create and open to create the new data page.
- To the right of DPLoadContact, click the crosshairs to open that Activity.
- Click Save as to save a copy to your ruleset.
- In the Apply to field, enter PegaCA-Data-MyContact
- In the Add to ruleset, enter PegaCS-Sample and version 08-05-02.
- Click Create and open to create the new activity.
- Click the Pages & Classes tab to update the pages used in the activity.
- In the Class field, change the AppContact class to PegaCA-Data-MyContact to reflect your data class.
- Click the Plus icon to add a new page and use the following details:
- Page name: RESTService
- Class: CPM-Int-External-GET_ExternalContactDataAPI
- 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.
- Click Add a step to configure a new Page-New step with the following details:
- Method: Page-New
- Step page: RESTService
- Click Add a step to configure a new Property-Set step with the following details:
- Method: Property-Set
- Step Page: RESTService
- Expand the new Property-Set step and configure it to set the contact ID in the request object for the REST service.
- PropertiesName: .request.ContactId
- PropertiesValue: Param.ContactId
- Click Add a step to configure a new Connect-REST step with the following details:
- Method: Connect-REST
- Step Page: RESTService
- Expand the Connect-REST step and set the ServiceName to GET_ExternalContactData.
- Click Add a step to configure a new Apply-DataTransform step to with the following details:
- Method: Apply-DataTransform
- Step Page: AppContact
- Expand the Apply-DataTransform step and set the DataTransform to MapRESTResponse.
- Save and Check In your activity.
6 Confirm your work
- Click Launch web interface > Interaction Portal to open the Interaction Portal.
- Click New > Demo Screen Pops > Demo Pop – CONNOR to start an interaction with Sara Connor.
- Click Accept to begin the call. Observe that the call is now from Pat Smith.
- In the header, notice the contact information now displays the details for Pat Smith.
- Click Wrap up and then Submit to finish the interaction.
- Close the browser that contains the Interaction Portal.