Updates a submission.
Each time the submission is updated, revision
increments by 1. The existing revision
must be included when updating the submission. This ensures you're working with the latest submission information, and prevents unintended overwrites.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateSubmission(
_id: string,
submission: UpdateSubmission,
options: UpdateSubmissionOptions,
): Promise<FormSubmission>;
Submission ID.
Submission to update.
import { submissions } from "wix-forms.v2";
/*
Sample _id value: "abb9b5c9-a881-467c-9c34-b9bea43ca5f0"
Sample submission value:
{
"formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
"seen": false,
"status": "CONFIRMED",
"revision": "6",
"submissions": {
"first_name": "Jane",
"last_name": "McBride"
}
}
*/
export async function myUpdateSubmissionFunction(_id, submission) {
try {
const updatedSubmission = await submissions.updateSubmission(
_id,
submission,
);
console.log("Success! Updated submission:", updatedSubmission);
return updatedSubmission;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
{
"formId": "21bcb6c7-02b3-4ed1-b6db-7856094fac03",
"namespace": "wix.form_app.form",
"status": "CONFIRMED",
"submissions": {
"last_name": "McBride",
"first_name": "Jane"
},
"revision": "6",
"submitter": {
"applicationId": "151e476a-715e-ec33-db9a-a7ff4d51f70a"
},
"seen": false,
"_id": "abb9b5c9-a881-467c-9c34-b9bea43ca5f0",
"_createdDate": "2023-12-28T12:54:04.652Z",
"_updatedDate": "2023-12-28T14:33:02.571Z"
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.