cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to get CreatedBy UserID/UUID from the service request table in ODATA?

shenu
Participant

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee
0 Likes

Hello,

ServiceRequestCollection donot return the UUID of the employee who made the change. However it still contains the name of the employee/service agent who made that change.(see field LastChangedBy)

So now, you can use the value from "LastChangedBy" of ServiceRequestCollection OData response and pass it as a filter to the EmployeeCollection entityset in the field BusinessPartnerFormattedName and get IdentityUUID from there.

Example: OData to request Last Changed by Field: https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection('00163EAF873D1EEB88C7925745077E7C')?$select=ID,LastChangedBy

Sample Response: service-request.png

Now copy the value of LastChangedBy from response of last odata call and pass it as filter:

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/EmployeeCollection?$filter=BusinessPa... eq 'Saurabh Kabra BU'&$select=IdentityUUID

Sample Reponse: employeeidentityuuid.png

shenu
Participant
0 Likes

Thanks, Saurabh, but this will give me the UUID of the user who last made the change. This can be different from the user who actually created the ticket which is in the 'Created By' field. If I use name from this field to get UUID in Employee Collection, it will create issues for associates with duplicate names

former_member226
Employee
Employee
0 Likes

Hello,

It was just an example of how to deal with such a case when you have just the "Employee Name" in the service request collection.

Nevertheless, in your case you need to replace "LastChangedBy" with "CreatedBy" to retrieve the employee who created the ticket. A sample URL would be as follow:

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection('00163EAF873D1EEB88C7925745077E7C')?$select=ID,CreatedBy

Rest everything for getting the employee UUID still remains the same.

shenu
Participant
0 Likes

I get that Saurabh and appreciate your advise 🙂 The problem here is that name is not a unique identifier and thus we cannot rely on it to get accurate results, especially in case where we have users with duplicate names. Is there any other way to do the join from service request to employee table?

former_member226
Employee
Employee

As LastChangedBy or CreatedBy is not really any "business" party but rather "changelog/audit relevant" party hence SAP do not offers any standard association for them to drill down to the level of details for ticket BO.(why? That I do not know)

But with just the standard Odata offering,based on my analysis, it is not possible to read the UUID. If needed then you can inlcude a new KUT/PDI field and copy the content from ServiceRequest.SystemAdministrativeData.CreationIdentityUUID to your customer field. Now you can expose this field to OData (standard or custom) and consuje it outside of SAP C4C.

Answers (0)