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
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.
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.