Survey A2A enables the external application to send Asynchronous responses of the survey in the Cloud for Customer system through an external portal (which is part of integrated software system of the business enterprise).
2 Response Capture Service Details
In the Survey A2A service, the structure fields are derived from the Questionnaire BO.
Query all the Questions with Answers for a Response Item:
To query all the questions in the survey we can use the below URL:
https://<C4CSystem>/sap/c4c/odata/v1/survey/ResponseCollection(‘<key1>’)/ResponseItem(‘<key2>’)/QuestionAnswers
<Key1>-> corresponds to Questionnaire -> Valuation_Collection Node
<Key2>-> corresponds to Questionnaire -> Valuation Node
Note : 1 ) This A2A Webservice also supports the inclusion of new surveys to Visit while at the same time responses can be captured
2 ) Only Survey Type ‘Checklists’ are supported with this A2A web service.
Essentially there maybe different structure expected by this web service for different question types-
The basic schema for Question-Answer structure-
<Answers>
<QuestionUUID> XXXX </QuestionUUID> — > Element UUID
<QuestionOptionUUID> yyyy </QuestionOptionUUID> — > Element Value UUID
/*< Value tags >*/ — > Question(/Element) type dependent
</Answers>
-
- Question Type – Date
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE12AE34</QuestionUUID>
<Date>2019-09-26</Date>
</Answers>
-
- Question Type – Amount
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE128E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE180E34</QuestionOptionUUID>
<Amount currencyCode=“USD”>2019</Amount>
</Answers>
-
- Question Type – Quantity
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE126E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE17CE34</QuestionOptionUUID>
<Quantity unitCode=“MTR”>1989</Quantity>
</Answers>
-
- Question Type – Multi Choice Single Select
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE126E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE17CE34</QuestionOptionUUID>
<Indicator>true</Indicator>
</Answers>
-
- Question Type – Multi Choice multi select
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE11EE34 </QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE154E34 </QuestionOptionUUID>
<Indicator>true</Indicator>
</Answers>
-
- Question Type – Text
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE12CE34</QuestionUUID>
<Text languageCode=“EN”>Demo Test 1234</Text>
</Answers>
-
- Question Type – Numeric
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE132E34</QuestionUUID>
<Numeric>12</Numeric>
</Answers>
-
- Question Type – Date Range
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE11AE34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE140E34</QuestionOptionUUID> <*UUID of Start Date Element Value *>
<Date>2019-09-26</Date>
</Answers>
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE11AE34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE142E34</QuestionOptionUUID> <*UUID of End Date Element Value *>
<Date>2020-09-26</Date>
</Answers>
-
- Question Type – Matrix (Show Answer As – Numeric)
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>12</value>
</Rating>
</Answers>
-
- Question Type – Matrix (Show Answer As – Text)
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>Hello C4C</value>
</Rating>
</Answers>
-
- Question Type – Matrix (Show Answer As – Radio button)
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>X</value>
</Rating>
</Answers>
-
- Question Type – Matrix (Show Answer As – Checkbox)
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>X</value>
</Rating>
</Answers>
-
- Question Type – Matrix (Show Answer As – Dropdown)
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE13CE34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-311017CBEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>00163E5F-ADE7-1ED8-AF96-311017CCEE34</value>
</Rating>
</Answers>
Sample XML to capture responses-
<n0:SurveyResponseMaintainBundleRequest xmlns:n0=“http://sap.com/xi/SAPGlobal20/Global“>
<MessageHeader>
<UUID >12345678-90AB-CDEF-0123-456789ABCDEF</UUID>
<ReferenceUUID>12345678-90AB-CDEF-0123-456789ABCDEF</ReferenceUUID>
<CreationDateTime>2016-05-23T12:00:00.1234567Z</CreationDateTime>
<SenderBusinessSystemID>Q9CCLNT400</SenderBusinessSystemID> “Business System (Sender ID) Message communication arrangement should be configured”
</MessageHeader>
<SurveyResponseRequestMessage>
<MessageHeader>
<UUID>12345678-90AB-CDEF-0123-456789ABCDEF</UUID>
<ReferenceUUID>12345678-90AB-CDEF-0123-456789ABCDEF</ReferenceUUID>
<CreationDateTime>2016-05-23T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ID>1161</ID> “Survey Root ID
<!–Zero or more repetitions:–>
<ValuationCollection>
<ValuationCollectionUUID>00163E12-BA69-1EE5-B9C5-182304D5BB97</ValuationCollectionUUID> “This has to be a new UUID when attaching the survey to the Visit for the first time
<Valuation>
<ValuationUUID>00163E12-BA69-1EE5-B9C5-182304D5DB97</ValuationUUID>
“Valuation UUID can be blank when attaching survey for the first time, but must be filled for update cases
<Answers>
<QuestionUUID>00163E12-BA69-1EE5-B9C4-C5E9F681DA63</QuestionUUID>”Survey-> Element UUID
<QuestionOptionUUID>00163E12-BA69-1EE5-B9C4-CA74CB0D5A95</QuestionOptionUUID>”Survey -> Element Value UUID
<Indicator>true</Indicator>
</Answers>
<Answers>
<QuestionUUID>00163E12-BA69-1EE5-B9C4-D0DDE0E65AA5</QuestionUUID>
<QuestionOptionUUID>00163E12-BA69-1EE5-B9C4-D16FFC4F3AA6</QuestionOptionUUID>
<Amount currencyCode=“USD”>234</Amount>
</Answers>
</Valuation>
<BusinessTransactionDocumentUUID>00163E12-BA40-1EE6-8898-FB33BD4F54C2</BusinessTransactionDocumentUUID>” Visit’s UUID, this is the important field when attaching the survey to a Visit, not needed for update cases where survey is already attached to the corresponding visit
<BusinessTransactionDocumentTypeCode>12</BusinessTransactionDocumentTypeCode>
“Visit’s BTD Type Code, as mentioned above in the same manner this is also not needed for update cases where survey is already attached to the corresponding visit
</ValuationCollection>
</SurveyResponseRequestMessage>
</n0:SurveyResponseMaintainBundleRequest>
3 Communication Arrangement
In the communication arrangement, communication settings must be made for both inbound and outbound communications
It is an Asynchronous service thus it sends the response back only forsuccessful web service calls via a separate message for the confirmation of posting
Note : for failed messages / failed postings there is no response back to the calling application (In C4C general A2A Asynchronous services do not send the error messages / failure notification of failed messages/web servicescall)
<n0:SurveyResponseMaintainBundleRequest xmlns:n0=”http://sap.com/xi/SAPGlobal20/Global”>
<MessageHeader>
<UUID >12345678-90AB-CDEF-0123-456789ABCDEF</UUID>
<ReferenceUUID>12345678-90AB-CDEF-0123-456789ABCDEF</ReferenceUUID>
<CreationDateTime>2016-06-01T12:00:00.1234567Z</CreationDateTime>
<SenderBusinessSystemID>Q9CCLNT400</SenderBusinessSystemID>
</MessageHeader>
<SurveyResponseRequestMessage>
<MessageHeader>
<UUID>12345678-90AB-CDEF-0123-456789ABCDEF</UUID>
<ReferenceUUID>12345678-90AB-CDEF-0123-456789ABCDEF</ReferenceUUID>
<CreationDateTime>2016-06-01T12:00:00.1234567Z</CreationDateTime>
</MessageHeader>
<ID>4560</ID>
<!–Zero or more repetitions:–>
<ValuationCollection>
<!–Optional:–>
<Status>initial</Status>
<ValuationCollectionUUID>00163E5F-ADFA-1EE8-B0E2-CFC10536E224</ValuationCollectionUUID>
<!–Zero or more repetitions:–>
<Valuation>
<!–Optional:–>
<ValuationUUID>00163E5F-ADFA-1EE8-B0E2-CFC105370224</ValuationUUID>
<!–Zero or more repetitions:–>
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<value>3121</value>
</Rating>
</Answers>
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE132E34</QuestionUUID>
<Numeric>1222</Numeric>
</Answers>
<Answers>
<QuestionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE138E34</QuestionUUID>
<QuestionOptionUUID>00163E5F-ADE7-1ED8-AF96-30F1FE1BEE34</QuestionOptionUUID>
<Rating>
<nodeId>00163E5FADE71ED8AF9630F1FE1C6E34</nodeId>
<text>Hello C4C</text>
</Rating>
</Answers>
</Valuation>
<BusinessTransactionDocumentUUID>00163E5F-ADF2-1EE8-AEFF-DA9F3FC778D5</BusinessTransactionDocumentUUID>
<BusinessTransactionDocumentTypeCode>12</BusinessTransactionDocumentTypeCode>
</ValuationCollection>
</SurveyResponseRequestMessage>
</n0:SurveyResponseMaintainBundleRequest>