Creating and Testing a Custom Key Metric in SAP Sales Cloud and SAP Service Cloud Version 2

Objective

After completing this lesson, you will be able to create and configure a custom key metric and test it within SAP Sales Cloud and SAP Service Cloud Version 2.

Creation of a Communication System and Custom Key Metric

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 SettingsAll SettingsIntegrationCommunication 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.

This screenshot shows the Communication Systems page SAP Sales & Service Cloud Version 2, with a panel to create an outbound communication system open and the system configured.

Create a Custom Key Metric

After the communication system is active, the next step is to create the key metric itself.

  • Navigate to SettingsAll SettingsCustomer InsightsCustom 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.

This screenshot shows the View Key Metric configuration panel open in SAP Sales Cloud and SAP Service Cloud Version 2 with all required fields configured.

Testing of the Key Metric Integration

To test the configuration:

  • Navigate to the Accounts work center in SAP Sales Cloud and SAP Service Cloud Version 2.

  • From the list, select any existing account to open its detail view.

  • Once the account is open, switch to the General tab.

  • In the Key Metrics section, all KPIs related to the account are displayed.

If the configuration is correct, the newly created Custom Pie Chart metric appears alongside the standard metrics. The system automatically calls your microservice through the configured communication system and renders the returned data inside the chart. This confirms that the key metric is active and that the integration between SAP Sales Cloud and SAP Service Cloud Version 2 and your microservice is functioning as expected.

The Account Overview page in SAP Sales Cloud and SAP Service Cloud Version 2 displays several Key Metrics in the General tab, shown in this screenshot. Among the standard KPI tiles, the custom metric “Custom Pie Chart” appears on the right side, showing the data retrieved from the microservice.

Summary

  • A new outbound communication system was created to connect SAP Sales Cloud and SAP Service Cloud Version 2 with the deployed key metric microservice.
  • The key metric configuration was added in the Customer Insights area, linking the metric to the /customPieChart endpoint of the microservice.
  • A two-step save process was completed to activate the key metric and store the overall configuration.
  • The integration was validated by opening an account record and confirming that the Custom Pie Chart metric is displayed in the Key Metrics section.