Search.../

querySubmissionsByNamespace( )

Creates a query to retrieve a list of submissions.

Description

Note: The Submissions API is only available in Wix Studio and Editor X.

The querySubmissionsByNamespace() method builds a query to retrieve a list of submissions from the specified namespace and returns a SubmissionsQueryBuilder object.

Note: You can only query submissions from a specified namespace. Use the query filter on the namespace field, otherwise you will receive an error.

The returned object contains the query definition, which is typically used to run the query using the find() method.

You can refine the query by chaining SubmissionsQueryBuilder methods onto the query. SubmissionsQueryBuilder methods enable you to sort, filter, and control the results that querySubmissionsByNamespace() returns.

The following SubmissionsQueryBuilder methods are supported for querySubmissionsByNamespace(). For a full description of the Submissions object, see the object returned for the items property in SubmissionsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_idascending(),descending()
formIdascending(),descending()
namespaceeq()
statusascending(),descending()
_createdDateascending(),descending()
_updatedDateascending(),descending()
seenascending(),descending()
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function querySubmissionsByNamespace(options: QuerySubmissionsByNamespaceOptions): SubmissionsQueryBuilder

querySubmissionsByNamespace Parameters

NAME
TYPE
DESCRIPTION
options
Optional
QuerySubmissionsByNamespaceOptions

Query options.

Returns

Was this helpful?

Query submissions by namespace (dashboard page code)

Copy Code
1import { submissions } from 'wix-forms.v2';
2
3export async function myQuerySubmissionsByNamespaceFunction() {
4 try {
5 const items = await submissions.querySubmissionsByNamespace()
6 .eq('namespace', 'wix.form_app.form')
7 .find()
8 console.log('Success! Submissions:', items);
9 return items
10 } catch (error) {
11 console.error(error)
12 }
13}
14
15/* Promise resolves to:
16[
17 {
18 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
19 "namespace": "wix.form_app.form",
20 "status": "CONFIRMED",
21 "submissions": {
22 "last_name": "Doe",
23 "first_name": "John"
24 },
25 "revision": "3",
26 "submitter": {
27 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
28 },
29 "seen": false,
30 "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0",
31 "_createdDate": "2023-12-28T12:54:04.652Z",
32 "_updatedDate": "2023-12-28T12:54:05.483Z"
33 },
34 {
35 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
36 "namespace": "wix.form_app.form",
37 "status": "CONFIRMED",
38 "submissions": {
39 "last_name": "McBride",
40 "first_name": "Patsy"
41 },
42 "revision": "3",
43 "submitter": {
44 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
45 },
46 "seen": false,
47 "_id": "f8281b62-1b2f-45bf-ba7d-f041d7653d2d",
48 "_createdDate": "2023-12-28T12:55:55.630Z",
49 "_updatedDate": "2023-12-28T12:55:56.233Z"
50 }
51]
52*/
Query submissions by namespace (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { submissions } from 'wix-forms.v2';
3import { elevate } from 'wix-auth';
4
5export const myQuerySubmissionsByNamespaceFunction = webMethod(Permissions.Anyone, async () => {
6 try {
7 const elevatedQuerySubmissions = elevate(submissions.querySubmissionsByNamespace);
8 const items = await elevatedQuerySubmissions()
9 .eq('namespace', 'wix.form_app.form')
10 .find();
11 console.log('Success! Submissions:', items);
12 return items;
13 } catch (error) {
14 console.error(error);
15 }
16});
17
18/* Promise resolves to:
19[
20 {
21 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
22 "namespace": "wix.form_app.form",
23 "status": "CONFIRMED",
24 "submissions": {
25 "last_name": "Doe",
26 "first_name": "John"
27 },
28 "revision": "3",
29 "submitter": {
30 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
31 },
32 "seen": false,
33 "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0",
34 "_createdDate": "2023-12-28T12:54:04.652Z",
35 "_updatedDate": "2023-12-28T12:54:05.483Z"
36 },
37 {
38 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
39 "namespace": "wix.form_app.form",
40 "status": "CONFIRMED",
41 "submissions": {
42 "last_name": "McBride",
43 "first_name": "Patsy"
44 },
45 "revision": "3",
46 "submitter": {
47 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
48 },
49 "seen": false,
50 "_id": "f8281b62-1b2f-45bf-ba7d-f041d7653d2d",
51 "_createdDate": "2023-12-28T12:55:55.630Z",
52 "_updatedDate": "2023-12-28T12:55:56.233Z"
53 }
54]
55*/
56