Create a Communication System
In this lesson, you will connect the key metric microservice created in the previous lesson with SAP Sales Cloud and SAP Service Cloud Version 2. The goal is to configure the platform so that the system can call the /customPieChart endpoint and display the returned metric as a custom chart. The overall process follows the same steps you already completed in the previous lesson, Configuring and Testing a Custom Logic Microservice in SAP Sales Cloud and SAP Service Cloud Version 2. Since the setup procedure is identical, this lesson focuses only on the values that differ for the key metric configuration.
To begin, open your SAP Sales Cloud and SAP Service Cloud Version 2 tenant and navigate to the Settings area. Choose Settings→All Settings→Integration→Communication Systems.
Create a new outbound communication system to define how SAP Sales Cloud and SAP Service Cloud Version 2 connects to the key metric microservice deployed on SAP BTP.
Enter KeyMetricCommunicationSystem as the Display ID and provide a short description such as Create a Key Metric.
Switch to the Outbound tab and set the Protocol to https.
In the Host Name field, enter the route of your deployed key metric microservice.
Note
You can view the route in the SAP BTP cockpit under the corresponding Cloud Foundry space in your subaccount (Go to your Global Account → Subaccount → Cloud Foundry → Spaces → Choose your Space → Choose your application ).
Keep the Authentication Method set to None.
Once all fields are completed, save and activate the communication system.

Create a Custom Key Metric
After the communication system is active, the next step is to create the key metric itself.
Navigate to Settings→All Settings→Customer Insights→Custom Key Metrics and create a new entry.
In the configuration dialog, define the Key Metric Name as MicroserviceKeyMetric and enter a title such as Custom Pie Chart .
For the Chart Type, choose PIE. The Service Full Name field is prefilled with sap.crm.service.insightsService.
In the API Path field, enter /customPieChart, which corresponds to the endpoint implemented in the custom microservice’s app.js file.
The HTTP Method is already set to POST.
Now choose the KeyMetricCommunicationSystem you created earlier and make sure the key metric is set to Visible .
After filling in all required fields, choose Save to create the key metric.
Once the entry appears in the list, make sure to choose Save again to store the overall key metric configuration.
Note
This final confirmation is essential, as the key metric will not become active unless the second save is completed.
With these settings in place, the system can now request the predefined metric data from your microservice and visualize it as part of the Customer Insights experience. The key metric is fully integrated and can be used anywhere in SAP Sales Cloud and SAP Service Cloud Version 2 where custom insight charts are supported.

