Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ralph_reinemann
Advisor
Advisor

Introduction (why this is relevant to the reader)
In the technical introduction of this series we explained how a UI Integration Card can be setup to allow the user in the SAP SuccessFactors Work Zone creating a ticket in the SAP Customer Experience (Employee Central Service Center). However, you may remember that we used a technical user to do so. In this article will now shed light on how to create the ticket on behalf of the logged in user.



Goal


Goal of this tutorial is therefore to resolve the user identity and provide the correct information to the SAP Customer Experience so that the requestor can be identified.



Overview Software Components



Series:


This blog post is part of a series

Prerequisites:


In order to complete this tutorial, you will need some basic understanding of the SAP Business technology Platform (BTP), Business Application Studio (BAS) and SAP SuccessFactors Work Zone.


BAS and SAP SuccessFactors Work Zone should be configured so that a direct deployment is possible, but this is not mandatory.


Further Information how to set up the deployment can be found here Link


As ticket system, we will be using is SAP Customer Experience, but you could adapt the following tutorial to any other system providing REST APIs for external communication.


Required Software Components


To implement the solution described in this tutorial, you should have access to the BTP Cockpit, BAS, SAP SuccessFactors Work Zone and SAP Customer Experience.



Implementation


During this tutorial, we will impersonate 2 users: the administrator (or technical user) and the end user.


The main effort will reside on the administrator side, who will:




  • Adapt the API Permissions

  • Add a Data Source for User Information

  • Ui Integration Card Adaption


Eventually, the end user will create a ticket through the SAP SuccessFactors Work Zone UI Integration Card.



Architectural Overview



Adapt the API permissions of the technical user in SAP Service Cloud


As you may know, the technical user in SAP Service Cloud has only limited permissions. To gather user information from the application we need to extend the permissions first.


Login to your SAP Service Cloud as administrator and go to General Settings. Scroll to the Integration area and select Communication Arrangements. Here you’ll see a list of your Communication arrangements including the one you created for the initial card



SAP Service Cloud - Communication Arrangements


Select it and click Edit in the upper right corner and get to the tab Technical Data. Here you’ll see the services we assigned as first part of this series.


Add the following services: employeeanduser and employeebasicdata



SAP Service Cloud - Communication Arrangements Services


Save and Reactivate your Communication Arrangement.




Add a Data Source for the User Information in SAP Service Cloud


Log in to your SAP BTP Subaccount and go to Connectivity > Destination where you initially created the destination for the first part of this Series.

In here we could easily adapt the current Destination and/or create new ones. For this tutorial we will clone the existing SAP CX Destination.


BTP Destination


Rename your cloned Destination to SAPCX_Employee  and adapt the URL of the Destination as followed


……/sap/c4c/odata/v1/c4codataapi/


Your URL should look something like this:


https://<your_id>.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi


Provide your password which you defined in the technical introduction of this series.




Resolve the User Context Variable & Adapt the payload


Open your BAS and the project which was created in Part I of this series. Go to the manifest and add the following parameter to the configuration:



"parameters": {
"userId": {
"value": "{context>sap.successfactors/currentUser/id/value}",
"type": "string",
"visible": true
}

This will resolve the SAP SuccessFactors User Id from the context and can be used to gather the correct user Id’s from SAP Service Cloud. Alternatively, you could also use the Identity Management Service as source for various IDs. In this scenario we will continue with the direct connection to SAP Service Cloud.


Add the newly created destination to your destinations in the UI Integration Card



"destinations": {
"SAPCX": {
"name": "SAPCX"
},
"SAPCX_Employee": {
"name": "SAPCX_Employee"
}

And add the following code to the sap.card area of the manifest. This will call the User information of the logged in user from the SAP Service Cloud.



"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"data": {
"request": {
"url": "{{destinations.SAPCX_Employee}}/EmployeeCollection?$filter=EmployeeID eq '{{parameters.userId}}'",
"parameters": {
"$format": "json"
},
"withCredentials": true
},
"path": "/d/results/0"
}

Now we need to add the response of the call to our payload. Therefore, add a new field to you UI Integration Card:



{
"type": "Input.Text",
"placeholder": "User ID",
"label": "Your ECSC User ID",
"isRequired": true,
"value" : "${BusinessPartnerID}",
"style": "text",
"id": "User"
}

To identity the user ID needed for the payload we use the field BusinessPartnerID from the response payload. If your configuration is different, adapt the value of the field with the correct value. The final step is now to add the field value to the payload of the card. Therefore, simply add the field to the payload defined in your manifest. Your payload of the actionHandler should then look like this:



"parameters": {
"Name": "{form>/Subject}",
"ReportedForPartyID": "{form>/User}"
}

Your card should now look like this:


As the user field should not be accessible, we add the following attribute to the newly created field:



"isVisible": false

Now deploy the card while providing a new version to it.




Validation


Login to your SAP SuccessFactors Work Zone and access the card provide a meaningful description and submit it



UI Integration Card in SAP SuccessFactors Work Zone


Switch to your SAP Service Cloud and see the result.



Ticket in SAP Service Cloud


 

Conclusion


In this tutorial it was shown how to connect an SAP Service Cloud application to the SAP SuccessFactors Work Zone to empower employees to submit specific service requests to the service delivery organization in the form of tickets.


The creation of a ticket can now be gently and personalized done from the SAP SuccessFactors Work Zone vie a UI Integration Card consuming the BTP Destination service and finally posting against the SAP Service Cloud.