Survey123 Power Automate Trigger Issues

3258
15
Jump to solution
11-23-2021 10:52 AM
RobertAnderson3
MVP Regular Contributor

I've been using Automate for a handful of surveys my organization uses, last week I went to create a webhook for a new survey that follows the same basic structure as previous ones. 

First issue I had was it wouldn't display any dynamic content, I fixed this by adding labels to every group/repeat, a bit annoying and cluttered but hey, it worked. I also want to point out I have webhooks/surveys that currently work and would allow me to work without this being the case.

This second issue I'm struggling with more. I get this error:

ResponseSwaggerSchemaValidationFailure. The API 'survey123' returned an invalid response for workflow operation 'When_a_survey_response_is_submitted' of type 'OpenApiConnectionWebhook'. Error details: 'The API operation 'AddData' requires the property 'body/feature/repeats/employee_repeat/0/attributes/addEmployees' to be of type 'String' but is of type 'Integer'.'

It's referring to a question on the survey that is a select_one using employee IDs as the data it passes. These have always passed as a string because it's a select_one question. However NOW it seems to be passing it as an integer, but because the field is a string it sees a mismatch and it breaks it. If I remove that field from the actions in the webhook it let's it run, but it's a fairly important attribute to include.

Anyone have any ideas what's causing this? Is there an issue with updates to Survey123 recently?

1 Solution

Accepted Solutions
BarbaraWebster1
Esri Regular Contributor

Hi Robert,

The error you're seeing with the select_one field type is caused by a change starting in 3.12. We have an internal bug logged for this and are looking at ways to fix the issue.

A workaround in the meantime would be to create a calculate question in your survey, name it something like "employeeID_text", and populate it with the responses from the select_one question. You could then use that question in Power Automate instead of the select_one question.

Thanks,
-Barbara

View solution in original post

0 Kudos
15 Replies
BarbaraWebster1
Esri Regular Contributor

Hi Robert,

The error you're seeing with the select_one field type is caused by a change starting in 3.12. We have an internal bug logged for this and are looking at ways to fix the issue.

A workaround in the meantime would be to create a calculate question in your survey, name it something like "employeeID_text", and populate it with the responses from the select_one question. You could then use that question in Power Automate instead of the select_one question.

Thanks,
-Barbara

0 Kudos
RobertAnderson3
MVP Regular Contributor

Hi Barbara,

Thank you for the info!

Yes, I'll work with the hidden calculate question to get it up and running, I'm glad you guys are aware of it and working on it.

EDIT: I tried using a hidden note field first and it encountered the same issue. Starting a brand new text field and setting a hidden appearance did work though.

0 Kudos
StanislausCounty
New Contributor III

So... is this fixed?

DavidCriswell
New Contributor II

It doesn't appear to have been fixed as of today. @BarbaraWebster1 do you have any guidance on when this issue will be resolved? 

0 Kudos
BarbaraWebster1
Esri Regular Contributor

Hi @DavidCriswell @RobertAnderson3 @StanislausCounty,

The fix for this was included in the July 2022 Survey123 release. 

@DavidCriswell Are you still seeing the value being passed as an integer instead of a string for a select_one question? 

0 Kudos
StanislausCounty
New Contributor III

It only took 7 months, but at least it is fixed. We haven't changed anything on our side because we implemented the kluge that was originally suggested since that worked for us and at this point since things are working there is no reason for us to make changes.

0 Kudos
KelseyFournier
New Contributor

Barbara,

I am currently experiencing this same problem with power automate. My field that is triggering the error is a dateTime field. I tried to format it as a date instead to see if that would fix the problem, however it is still triggering the error. 

This survey is a built from a Host Survey and a different survey that I have that is also built off of a Host Survey with a similar dateTime field is not experiencing this same error. Do you have any suggestions or work arounds for this instance? I tried the above solution as a work around but it didn't work unfortunately. 

It appears that the select_one issue was resolved in the release, but not dateTime?

Thank you!

StanislausCounty
New Contributor III

If you know the version of Survey 123 Connect you published your previous surveys with you can use that to version to publish the problem child survey. Otherwise you are going to have to create a text question and use the calculate column to populate it with values from your date-time question and then parse that to reform the datetime object within power automate.

I wrote a python script to query and grab older software versions since Esri doesn't list them publicly. I'll attach it here; if you know the version that works just change the parameters to look for those so you don't slam the server.

0 Kudos
colelwhite
New Contributor II

I was having a similar dateTime issue and was able to resolve it within Power Automate by replacing any references to the date field with the following expression (replace 'DueDate' with the name of your date field):

formatDateTime(addSeconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/DueDate'],1000)), 'MMMM dd, yyyy')

Apparently something in the way S123 interfaces with Power Automate was causing date fields to be interpreted as per the Unix Epoch. I found the above calculation to convert it into the expected format and this resolved the issue for me.