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

ODATA to access c4c ticket survey answers

shenu
Participant
0 Likes
1,334

Hi SAP community,

I am trying to get the ticket survey answers from the C4C ODATA. However, I am unable to find the correct object with the details I am looking for. SurveyQuestionAnswersCollection only contains UUID and is not displaying all questions. Also, in order to connect a ticket to a survey, will I need to connect Object id with parent object id in the survey tables?Could you please provide some direction on this?

Thanks very much in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee
0 Likes

Hello,

You can use the following way to get the Survey Answers for ticket using OData c4codataapi.

1. Get the Ticket UUID using ServiceRequestCollection?$filter=ID eq '132163' .

2. Use the UUID from Step 1 to get the survey submitted using following:

SurveyResponseCollection?$filter=BusinessTransactionDocumentUUID eq <TicketUUID>

3. Now access the navigation property SurveyResponseItem from the response of step 2. and further navigate to SurveyQuestionAnswers. Here you will find all the responses to each question. Get the QuestuinUUID from here.

5. Now launch QuestionsCollection('<question UUID from Step 4>'). It will give you the entire information of question text.

BR

shenu
Participant
0 Likes

Thank you very much Saurabh. However, when I use the ticket UUID to get the survey submitted, I get no response 😕 The UUID from servicerequest doesnt seem to match transactiondocumentuuid. Could you please help on this?

former_member226
Employee
Employee

Hello,

I am not sure what you are missing, therefore I am writing here the full URLs to be used:

  1. https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection?$filter=ID eq '132151' --> Get the ObjectID property for Ticket ID 132151
  2. https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseCollection?$filter=Busi... eq '00163EAF87791EDB88C726DC115EE8F7' --> Here 00163EAF87791EDB88C726DC115EE8F7 is the ObjectID from step 1. From here get the ObjectID property for already added survey
  3. https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseItemCollection('00163EAF86841EDB8C8237DC13D107EC')/SurveyQuestionAnswers --> Here 00163EAF86841EDB8C8237DC13D107EC is the obejct ID from step 2

Navigation property ServiceRequestCollection will only work in case of a survey is already added to the ticket. If the survey is not yet added to the ticket then SurveyResponseCollection will be empty.

shenu
Participant
0 Likes

Hi Saurabh, I really appreciate your detailed response. I am executing the exact query that you posted for a ticket that has survey added to it. I found this ticket using report with Ticket Survey Answers as the datasource. When I do step 1 and 2 and filter for Object ID of my ticket in surveyresponsecollection, I receive no response.

Steps: 1. Found a ticket that has survey attached to it (cant see the survey in Ticket UI under surveys but can be seen in reports)

2. I use the queries as below

  1. https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection/?$filter=ID eq '708289' --> Got the ObjectID for Ticket ID as 00163E83B3171EEAA7EF581E7961FE7D
  2. https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseCollection/?$filter=Bus... eq '00163E83B3171EEAA7EF581E7961FE7D' - I get no result
former_member226
Employee
Employee

Hmmm. I can't see it beyond this without system access. Therefore I would suggest you to open a ticket to SAP Support and let them check this issue.

shenu
Participant
0 Likes

Thanks, Saurabh, looks like there is an issue at the backend 🙂 Also, I wanted to ask if you know which tables can be used to link Question and Answer UUID to its description?

former_member226
Employee
Employee
0 Likes

Hello,

Since C4C is a cloud solution, hence you don't have backend access to tables.

I believe you are talking about BO level access via SDK, if that the case then pls check BO Questionnaire and its node/association ValuationCollection. Here you will find everything.

Answers (0)