Symptom
Customer cannot have filtered results from SurveyQuestionAnswersCollection. Both using the fields ObjectID, ParentObjectID and QuestionAnswerOptionUUID to filter.
Customer needs to use this information (questions and answers surveys) for the call in SAP BTP for the creation of a PDF file with information.
Environment
SAP Cloud for Customer
Reproducing the Issue
1. Test using: https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyQuestionAnswersCollection -> see successful GET entries
2. Try to filter it -> Error <message xml:lang="en">Property XXXX not found in type SurveyQuestionAnswers</message>
Cause
In order to get results from SurveyQuestionAnswersCollection using the opportunity ID, go to surveyresponsecollection and provide the opportunity ID to the BusinessTransactionDocumentUUID field, then collect the object ID of the surveyresponsecollection, and pass it to the parent ID of surveyresponseITEMcollection, from there you can navigate to surveyquestionanswer.
Below are the API links for the given example-
https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseCollection?$filter= BusinessTransactionDocumentUUID eq 'XXXXXXXXXXXXXXXXXXXX'
This should give the required response.
Resolution
In addition, consider:
- The answers are stored in the SurveyQuestionAnswersCollection, and not in the SurveyQuestionCollection, you can directly use the provided link to check the answers of the survey that you navigated by using the opportunity objectID- https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseItemCollection('XXXXXXXXXXXXXXXXXXXX')/SurveyQuestionAnswers
- For a better view of data, you can use export data in the console to view it in Excel.
- For getting the question details, you can use the Question UUID (ID in common between the question and answer), from the SurveyQuestionAnswersCollection and use this question UUID to get the details about the question from -
- SurveyQuestionCollection or if you need the description of the question, you can use the SurveyQuestionDescriptionCollection- https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyQuestionDescriptionCollection?$filter=ParentObjectID eq 'XXXXXXXXXXXXXXXXXXXX' Here the parentObjectID is the QuestionUUID of the last answer of the survey.
- In order to view the response of a multiple choice question from - https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyResponseItemCollection('XXXXXXXXXXXXXXXXXXXX')/SurveyQuestionAnswers, check the QuestionAnswerOptionUUID, pass this ID in the entity set- SurveyQuestionAnswerOptionCollection for example- https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyQuestionAnswerOptionCollection('XXXXXXXXXXXXXXXXXXXX')
- For getting the description, use the same ID as parentobject ID example- https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SurveyQuestionAnswerOptionDescriptionCollection?$filter=ParentObjectID eq 'XXXXXXXXXXXXXXXXXXXX'
- For getting the associated survey from opportunity ID you can use https://my000000.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/OpportunityBusinessTransactionDocumentReferenceCollection?$filter=ParentObjectID eq 'XXXXXXXXXXXXXXXXXXXX' Provide opportunity object ID to parentobjectid as filter in the entity- OpportunityBusinessTransactionDocumentReferenceCollection.
Keywords
Filter; Results; SurveyQuestionAnswersCollection; ObjectID; ParentObjectID; QuestionAnswerOptionUUID; Questions and answers; Surveys. , KBA , LOD-LE-SUR-DEF , Survey definition = design time , How To