Hi! How can I fetch form submissions that belong to a webform that is referenced in a content type? I have created the webform and have also created a reference field for that form, in one of my content types. This works great because I'm able to use a "global" form but it encapsulates the submissions on each node of the content type. I am able to see the specific submissions that are attached by navigation to the "results" tab in the admin section of a node.
My issue is that I can't seem to figure out how to programmatically retrieve these results that are associated with the specific node. Is this something easy? I've been searching around and can't seem to find a solution. Thanks in advance!
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz at The Big Blue House commentedIf you are using an EntityQuery, you can call WebformSubmissionStorage::addQueryConditions helper method with your node as the $source_entity.
The code would look something like...
Comment #3
Rulito CreditAttribution: Rulito commentedThanks for the quick response! I added my corresponding ID's to the code you gave me and now getting the following error:
Any insight? Here's my current logic:
Thanks again for the help and for such an awesome module, really appreciate it!
Comment #4
jrockowitz CreditAttribution: jrockowitz at The Big Blue House commentedThere was a typo on my part. Please use
$submission_storage->addQueryConditions
w/ the 's'Comment #5
jrockowitz CreditAttribution: jrockowitz at The Big Blue House commentedComment #6
Rulito CreditAttribution: Rulito commentedPerfect! Exactly what I needed. Thanks so much for the help!