Search.../

getSubmission( )

Retrieves a submission by ID.

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

Admin Method

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

Syntax

function getSubmission(submissionId: string): Promise<GetSubmissionResponse>

getSubmission Parameters

NAME
TYPE
DESCRIPTION
submissionId
string

ID of the submission to retrieve.

Returns

Return Type:

Promise<
GetSubmissionResponse
>
NAME
TYPE
DESCRIPTION
submission
FormSubmission

The retrieved submission.

Was this helpful?

Get a submission (dashboard page code)

Copy Code
1import { submissions } from 'wix-forms.v2';
2
3/*
4Sample submissionId value: "abb9b5c9-a881-467c-9c34-b9bea43ca5f0"
5*/
6
7export async function myGetSubmissionFunction(submissionId) {
8 try {
9 const submission = await submissions.getSubmission(submissionId);
10 console.log('Success! Submission:', submission);
11 return submission;
12 } catch (error) {
13 console.error(error);
14 // Handle the error
15 }
16}
17
18/* Promise resolves to:
19{
20 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
21 "namespace": "wix.form_app.form",
22 "status": "CONFIRMED",
23 "submissions": {
24 "last_name": "Doe",
25 "first_name": "John"
26 },
27 "revision": "4",
28 "submitter": {
29 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
30 },
31 "seen": true,
32 "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0",
33 "_createdDate": "2023-12-28T12:54:04.652Z",
34 "_updatedDate": "2023-12-28T13:42:24.856Z"
35}
36*/
Get a submission (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
5/*
6Sample submissionId value: "abb9b5c9-a881-467c-9c34-b9bea43ca5f0"
7*/
8
9export const myGetSubmissionFunction = webMethod(Permissions.Anyone, async (submissionId) => {
10 try {
11 const elevatedGetSubmission = elevate(submissions.getSubmission);
12 const submission = await elevatedGetSubmission(submissionId);
13 console.log('Success! Submission:', submission);
14 return submission;
15 } catch (error) {
16 console.error(error);
17 // Handle the error
18 }
19});
20
21/* Promise resolves to:
22{
23 "formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
24 "namespace": "wix.form_app.form",
25 "status": "CONFIRMED",
26 "submissions": {
27 "last_name": "Doe",
28 "first_name": "John"
29 },
30 "revision": "4",
31 "submitter": {
32 "applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
33 },
34 "seen": true,
35 "_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0",
36 "_createdDate": "2023-12-28T12:54:04.652Z",
37 "_updatedDate": "2023-12-28T13:42:24.856Z"
38}
39*/
40