Query Or Create

Forms Developer Guides Scripting Page Not Found Page Not Found Submissions

QUERY_OR_CREATE(conditions)

Form.new(permalink).submissions.query_or_create(conditions).then(function(submission) {});

Queries for submissions using Simple Conditions Query JSON format. If the submission does not exist, one is initialized with the values provided and saved to the server. Use the query_or_initialize to initialize a submission without saving it.

This method only supports the Simple Conditions format listed.

Return Value Notes

The query methods return SubmissionData objects because they are optimized for large numbers of submissions. Normal Submission objects have overhead, so fewer could be loaded on average computers.

We recommend using the SubmissionData methods outlined in the documentation for reading or writing submission data, but if the user needs access to the record you can turn it into a Submission with the submission method. The method returns a promise which loads the submission.