Monday 27 January 2020

SAP Solution Manager – Qualtrics Integration

X+O case for IT Service Management

INTRODUCTION 


Qualtrics is an experience management platform, which combines the experience data and operational data (X+O) and provides meaningful and deep insights into customer expectations, patterns and helps to improve satisfaction.

The details and uses of Qualtrics are outlined in various other resources (refer links section below).

In this article I will try to explain how the integration from an on-premise system (in our case it was the SAP Solution Manager system 7.2) to Qualtrics works. I will try to highlight the important touch points with respect to integration, various technical aspects and how you can benefit in general from the integration.

USE CASE 


Our SAP Solution Manager ITSM solution was using CRM Standard survey suite for collecting positive call ratings for a ticket.

Wherein the customer rate the service delivery or issue resolution on different parameters like overall satisfaction, initial response time, update period, time to resolution and quality of solution.

Customers can also rate the ticketing tool experience and provide comments for improvement of tool and service delivery or resolution of issue. We decided to move satisfaction survey to the Qualtrics platform.

With this change of the survey platform the following goals were targeted:

◉ Improved user experience for customers filling the survey
◉ Easy maintenance of survey
◉ Better manage end user experience across support channels
◉ State of the art analysis of customer feedback and comments
◉ Visualize trends and patterns and to react on it
◉ Reveal correlation between user feedback and support process

We had the task also to bring survey results back into SAP Solution Manager along with link to filled in survey. This will be attached as part of the ticket for the benefit of service desk agents to query on ticket ratings and view them.

Otherwise every processor in the organization needs to have a user created in the Qualtrics survey platform.

PROCESS FLOW 


Below you find the data flow between different systems for our case

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

DETAILS


I will briefly touch on Qualtrics survey platform and not cover in detail how a survey is created or how a site interceptor project is created. 

Nor will touch base different creatives or Intercepts and their configuration. Which are detailed in the help document link above.  

Create Survey project in Qualtrics 

Create a sample survey project as below 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Survey Preview –>

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Created embedded data in the survey to be captured in the “Survey Flow”

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

In the above example I will try to capture objectID, email and Name of the customer 

Distributing the survey 

Qualtrics provides different ways to invoke or distribute survey and collect experience data. 

You can either use Website/App Feedback (Site interceptor), distribute the URL with embedded attributes or send via mail. 

Site Interceptor: 

Create Website/App Feedback project 

Create a pop-over Creative and Publish 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Create an Intercept with the creative as the popover, survey target as on-prem test 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Note: You can define creatives with different sizes so that you can also specify action sets for different screen resolution to show creatives (of different sizes for e.g. monitor/mobile/laptop) and also for different hosts or based on a JavaScript expression or based on HTML element on the website. 

Embedded data for Site Intercept 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

You can also use “Value from JavaScript” to read values from html elements in your application or create hidden html elements for survey embedded data.

Qualtrics Survey Interceptor will read from these html elements and pass them to response data. 

document.getElementById or document.querySelector to read an element or with pattern 

Publish and Activate your Intercept 

Go to “Settings” tab and copy the JavaScript code snippet (this will be placed in your BSP application component htm page) 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select option “Display with custom JavaScript code (Manually)”  

Let’s also look at the simple URL with embedded data to collect feedback 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Notice the embedded data towards the end of URL 

?Q_CHL=si&objectID=12345&email=xyz%40sap%2Ecom&name=xyz 

which passes the embedded data to the Qualtrics Survey

Add the site interceptor script in header BSP component and Create HTML elements on the webpage for Site Interceptor 


Add the site interceptor script (section above on Site Interceptor) in the BSP Component. For our application as we wanted to have it on the main page we placed the script in the  

CRM_WORKAREAHDR/WorkAreaHeader.htm page 

<!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET--> 

<script type='text/javascript'> 

(function(){var g=function(e,h,f,g){ 

this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null}; 

this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "}; 

this.check=function(){var a=this.get(f);if(a)a=a.split(":");else if(100!=e)"v"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(":"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0}; 

this.go=function(){if(this.check()){var a=document.createElement("script");a.type="text/javascript";a.src=g;document.body&&document.body.appendChild(a)}}; 

this.start=function(){var a=this;window.addEventListener?window.addEventListener("load",function(){a.go()},!1):window.attachEvent&&window.attachEvent("onload",function(){a.go()})}}; 

try{(new g(100,"r","QSI_S_ZN_9Ah03bqMBAKrxY1","https://abcdefgh-surveyaccount.qualtrics.com/WRSiteInterceptEngine/?Q_ZID=ZN_9Ah03bqMBAKrxY1")).start()}catch(i){}})(); 

</script><div id='ZN_9Ah03bqMBAKrxY1'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div> 

<!--END WEBSITE FEEDBACK SNIPPET--> 

Also add the below code to trigger the site intercept in the webUI on click of an action or when a variable is set 

<%
  if not controller->gv_call_intercept is initial.
%>
<span hidden id="objectID"><%= lv_objectID %></span> 
<span hidden id="email"><%= lv_email %></span> 
<span hidden id="name"><%= lv_name %></span> 

<script type="text/javascript">
if ( typeof QSI !== 'undefined' && typeof QSI.API !== 'undefined' ) {
console.log( "Calling SI API" );
 QSI.API.unload();
 QSI.API.load().done(QSI.API.run);
} else {
console.log( "Can't find SI API" );
}
<%
  clear controller->gv_call_intercept.
%>
</script> 

Ensure to create hidden HTML elements in the webpage with the same name as you mentioned in the survey as well as Site Interceptor Embedded data.  

Details on QSI.API.load(), unload() and run() is available in the Qualtrics API documentation.

Create OData service to fetch the results back from Qualtrics 


As a next step I have created a simple OData service to fetch the survey feedback from Qualtrics and store it in the ticket in our SAP Solution Manager ITSM. 

Basically a POST with a technical user and password from Qualtrics sends the data to SAP Solution Manager system 

https://yourhost:port/sap/opu/odata/sap/ZQUALTRICS_SVY_SRV/SurveyFromQualtricsSet?$format=json 

with JSON structure 

    "d": { 
        "results": [ 
            { 
                "__metadata": { 
                    "id": " https://yourhost:port/sap/opu/odata/sap/ZQUALTRICS_SVY_SRV/SurveyFromQualtricsSet (1234567890l)", 
                    "uri": " https://yourhost:port/sap/opu/odata/sap/ZQUALTRICS_SVY_SRV/SurveyFromQualtricsSet (1234567890l)", 
                    "type": "ZQUALTRICS_SVY_SRV.SurveyFromQualtrics" 
                }, 
                "ObjectID": "1234567890", 
                "Q1": 10, 
                "Q2": 1, 
                "Q3": 0, 
                "Comments": "Test 1", 
                "ResponseId": "123asdfg", 
                "ResponseLink": "Qualtrics Preview Link", 
                "ErrorText": "" 
            } 
        ] 
    } 

or any other material available in SAP Community 

The survey results are passed to the SAP Solution Manager system if the  

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Answer to first question is less than 8 

Answer to second question is not satisfied 

Answer to third question is no 

I also trigger an email to the email id passed part of the embedded data, along with the Call of OData service to notify the user about the rating and dis-satisfaction (could be manager or lead)

Note: If you can already expose your OData service to the external world from your SAP System, then you dont have to consider the next steps and directly continue with consuming the OData service in Qualtrics. But in our case the OData needs to be exposed and we choose SAP CP API Management.

Whitelist the service in web dispatcher and in cloud connector account 


As a next step you need  

1. Activate your OData service, maintain destination (depends on whether you have a central hub deployment or Embedded deployment) 
2. Whitelist your OData service URL from SAP Backend system or Gateway system in the web dispatcher 
3. Whitelist the OData service also in the Cloud Connector account of you SAP CPI 

Create API provider and API (used the technical user)- deploy the API 

Next you will create API Provider and an API to trigger from Qualtrics in SAP Cloud Platform API Management portal. 

API Provider will refer to your service URL with a technical user and password. 

I have created the API as below 

https://my.apimanagement.hana.ondemand.com/sap/opu/odata/sap/ZQUALTRICS_SVY_SRV/SurveyFromQualtricsSet 

Create action in Qualtrics Survey project to trigger the POST call to API 


Here I will create 2 actions in the Qualtrics survey platform  

Trigger email 

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Selected the Event as Survey Response – Created 

Conditions – when the answer to first question is detractor  

And 2nd and 3rd question answered as not satisfied and no 

This will send a mail automatically to the email ID from the embedded data (${e://Field/email}) 

Trigger OData service Call 

1. First select the Event as “Survey Response – Created” 
2. No Conditions – as we want to send all responses to back end, but if you want to send only responses with low feedback you can very well do that 
3. Tasks – Choose ‘Web Service Request”

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

4. Create Authorization token

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep


5. Enter Credentials and save

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

6. Enter API which you created in SAP Cloud Platform API Management and map embedded data fields to the API Request body

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

7. Save your actions and now it is ready to send data to backend 

8. Reporting Tab in actions also gives you the history of actions triggered API call or Emails

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

9. Click on status to view the Request header/body as well as Response from API call

NW ABAP Gateway (OData), SAP ABAP Tutorials and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Survey data stored in SAP Backend 

Once the POST call is successful from Qualtrics it will attach the survey feedback into the ticket in SAP Solution Manager system. 

No comments:

Post a Comment