Prevent Duplicates During Survey123 Submittal Process

05-07-2020 01:11 PM
New Contributor III

My goal is to prevent duplicate survey records from getting entered into the hosted feature service. I would like for the survey submittal to act similar to a database form when you try to insert a record with a duplicate key, it throws an error and aborts. I would like the survey to check for a unique ID to see if it already exists in the feature service records. If it already exists then an error message is presented to the user telling them of the problem and the submittal is aborted. If no record exists with the key then the submittal goes through. Is this kind of behavior possible using Survey123 and the hosted feature service?

In this post, I see how the surveys are moved to the Sent box when they are successfully submitted but that is not quite what we are looking for. Survey 123 Data in Sent folder not received in database



3 Replies
Esri Regular Contributor

Hi Bill,

We have a beta feature which might be closed to what you are requesting for.

Please check this document on our early adopter website:

Survey pulldata() properties: mode & status

You could use the pulldata() properties to identify the status of the survey, that way, if a survey is being submitted, the status will show Sent.

New Contributor III

Shwu-jing Jeng,

Thank you for your quick response and letting me know about the new Mode and Status properties. I may use them in the future. It looks like adding a unique constraint on a field in the feature layer will work for our workflow. This provides a clean error result in the Outbox when the user tries to submit a survey with a duplicate value for the unique constraint field.

Add a unique constraint to a field



New Contributor II

Hi there, I am using this option to prevent duplicate values being entered in my survey. However, I would really like the ability to let the submitter know why the survey was rejected. Anyone who may see this know of a way to customize the error message so it's not gibberish to a non-GIS user? 

0 Kudos