Skip to content

How to query related submissions for an asset? #1764

Answered by engram-design
rungta asked this question in Q&A
Discussion options

You must be logged in to vote

Are your File Upload fields in a Group or Repeater field? If so, that'll be tricky as each block for those fields is an element on it's own - just like Matrix and Super Table. That means that the relationship is tied between the asset and the Group/Repeater Block element.

However, using relatedTo for non Group/Repeater fields (so File Uploads at the top level of the form) should be fine. But you're going to run into issues using the field reference, because these are Formie fields, and not Craft fields.

craft.formie.submissions.relatedTo({ element: 19694 }).exists()

Works for me on top-level fields. For nested fields, you can only really do that in PHP.

\verbb\formie\elements\NestedFieldRow

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rungta
Comment options

Answer selected by rungta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants