I am trying to make an attachment required if a condition is met. When I set a condition and a minimum file count it still requires the attachment even when the attachment item is hidden (condition not met).
Is there a way to require attachments based on a condition?
Solved! Go to Solution.
Ok, thanks @TL2 for sending the repro data. From looking at the webmap you were using an editable expression on the attachment form element AND had a requirement of 1 attachment. To only enforce an attachment submission when a certain value is entered in a different field, you should use a visibility expression on the attachment element.
So the setup will be
The requirement is only enforced when the element is visible. Hope this helps!
I'm not seeing this issue in ArcGIS Online (organizational account). When I set my "attachment_required" question to "No", I am allowed to submit without an attachment. When I select "Yes", my attachment question becomes visible, and required (min set to 1). When I try to submit "Yes" without and attachment, i get an error (as expected). My "Editable" and "Visible" Arcade expressions are the same for the attachment question.
I am not able to reproduce this. Actually, when I try it will not work in the Map Viewer and in Field Maps I get an error - "The form contains unsupported data."
are you attempting to edit a view? have you tried with a new, simplified test version of the map and form, maybe just isolate the layer and add a form with the conditional question(s) and attachment question?
Yes , I created a new HFS with one field - required. I placed the rule for Edit and Visible on both. I set my domain values (yes,no). I have the latest version of Field Maps. I will open a ticket with ESRI.
please post a case/bug number and any other information you find out for others that may see similar issues!
@TL2 Can you send a screenshot of your form authoring settings? Do you have the media input set to Capture only? Also, if you are able to share the data with me/make it public please DM me and the team can investigate this further
Ok, thanks @TL2 for sending the repro data. From looking at the webmap you were using an editable expression on the attachment form element AND had a requirement of 1 attachment. To only enforce an attachment submission when a certain value is entered in a different field, you should use a visibility expression on the attachment element.
So the setup will be
The requirement is only enforced when the element is visible. Hope this helps!
@TL2 for Field Maps specifically, can you confirm the version of Field Maps that was used? If using a version prior to 26.2 that contains an attachment element, they will see this message.