Select to view content in your preferred language

Preventing editing in two part survey

294
7
Jump to solution
07-09-2025 01:56 PM
JadeLee1
Occasional Contributor

I have a 'two-part' survey, where users enter one survey connected to one feature layer (hosted) and then submit the second survey from the inbox in the second survey, completing the first part. I recently discovered that some of my users were editing the past submitted surveys (both part one and two) through the survey123 website, I can't disable updates since the users are editing the feature service when they submit the second survey. Is there any way I can disable the survey123 view? I still want them to be able to view their own results through a feature hosted view. If I disable the view option in 'Share results' will this prevent them to view their records through a feature hosted view?

0 Kudos
2 Solutions

Accepted Solutions
DavidSolari
MVP Regular Contributor

In that case I think you've hit a wall, ArcGIS doesn't have a "no more edits after this point" feature at a low enough level to absolutely prevent tampering. Some half-measures you can try:

  • Try adding a deviceid question to see if the survey is accessed from the field app or not, you might be able to make every question read-only if it's not accessed from the app.
  • Using webhooks you can look for "finished" forms and copy the data to a new survey that's read-only, which becomes your new view for reporting.
  • Run sweeps of the data to see if the last edit date differs from the completion date the user enters (or one you capture manually using an end question) and then deal with those people on a case-by-case basis. If this survey was talking to registered Enterprise data you could also roll the changes back on the database side but it sounds like that isn't an option.

View solution in original post

DeonLengton
Esri Regular Contributor

 

It should be possible to do. Try this:

  • Add a new field to your feature layer called part2_completed. Make it a text or integer field.

  • In the second survey (the one accessed through the inbox), add a calculate question that sets the value of part2_completed to "yes" when the survey is submitted.

  • In the first survey (the initial entry form), add a relevant expression to all key questions to hide them if part2_completed is equal to "yes".

  • Also in the first survey, add a constraint expression to prevent submission if part2_completed is equal to "yes", and include a message like "This record has already been completed and cannot be edited."

  • Optionally, use the bind::esri:readonly column to make fields read-only when part2_completed is "yes", effectively locking the form.

  • Republish both surveys.

  • Now, once a user submits the second survey, the first survey will either hide fields, prevent submission, or become read-only if someone tries to edit the record later—even via the Survey123 website.

 

View solution in original post

7 Replies
DavidSolari
MVP Regular Contributor

You can pop a filter on the Inbox that only allows surveys where a required stage 2 field is null (e.g. date_complete IS NULL or something). Once part 2 is done they shouldn't be able to hop back in there via the Inbox but it'll show up in maps and whatnot.

0 Kudos
JadeLee1
Occasional Contributor

Thanks! I do have a filter on the Inbox, so they aren't able to edit via the Inbox but my issue is that they are editing through the survey123 website.

0 Kudos
DavidSolari
MVP Regular Contributor

In that case I think you've hit a wall, ArcGIS doesn't have a "no more edits after this point" feature at a low enough level to absolutely prevent tampering. Some half-measures you can try:

  • Try adding a deviceid question to see if the survey is accessed from the field app or not, you might be able to make every question read-only if it's not accessed from the app.
  • Using webhooks you can look for "finished" forms and copy the data to a new survey that's read-only, which becomes your new view for reporting.
  • Run sweeps of the data to see if the last edit date differs from the completion date the user enters (or one you capture manually using an end question) and then deal with those people on a case-by-case basis. If this survey was talking to registered Enterprise data you could also roll the changes back on the database side but it sounds like that isn't an option.
JadeLee1
Occasional Contributor

Ok, thank you for your help!

0 Kudos
DeonLengton
Esri Regular Contributor

 

It should be possible to do. Try this:

  • Add a new field to your feature layer called part2_completed. Make it a text or integer field.

  • In the second survey (the one accessed through the inbox), add a calculate question that sets the value of part2_completed to "yes" when the survey is submitted.

  • In the first survey (the initial entry form), add a relevant expression to all key questions to hide them if part2_completed is equal to "yes".

  • Also in the first survey, add a constraint expression to prevent submission if part2_completed is equal to "yes", and include a message like "This record has already been completed and cannot be edited."

  • Optionally, use the bind::esri:readonly column to make fields read-only when part2_completed is "yes", effectively locking the form.

  • Republish both surveys.

  • Now, once a user submits the second survey, the first survey will either hide fields, prevent submission, or become read-only if someone tries to edit the record later—even via the Survey123 website.

 

JadeLee1
Occasional Contributor

I think the readonly expressions are not supported in the web app, I was still able to edit through the Survey123 website using just the readonly column. I will try to use the constraint column.

0 Kudos
JadeLee1
Occasional Contributor

Thanks Deon! I will try making them read-only when they meet that condition.

0 Kudos