# Submissions

A Submission is a JSON object whose values were submitted to a form or resource. These can be thought of as “objects” within the system and operate very much like them. A typical submission JSON object looks like the following:

```javascript
{
    "_id": "123456789012345678901234",
    "data": {
        "firstName": "Sally",
        "lastName": "Thompson"
    },
    "metadata": {},
    "state": "submitted",
    "form": "123456789012345678901234",
    "project": "123456789012345678901234",
    "created": "2021-05-24T13:51:43.414Z",
    "modified": "2021-05-24T13:51:43.415Z",
    "owner": "123456789012345678901234",
    "roles": [],
    "access": []
}
```

These properties are described as follows:

| Property | Description                                                                                                                                  |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| \_id     | The MongoDB ID of the submission                                                                                                             |
| data     | The values of the form that were submitted.                                                                                                  |
| metadata | Additional metadata that is added to the submission, such as timezone information.                                                           |
| state    | The state of the submission.  "draft" for draft submission, and "submitted" would mean it has been submitted.                                |
| form     | The Form ID for this submission.                                                                                                             |
| project  | The Project ID where this submission resides.                                                                                                |
| created  | The date this submission was created.                                                                                                        |
| modified | The date this submission was modified.                                                                                                       |
| owner    | The ID of the "user" who created this submission.                                                                                            |
| roles    | If this submission is used as a "user" submission, these are the roles that are added to that user.                                          |
| access   | Access configurations for this submission. This is used when field based resource access is used to establish permissions to the submission. |

## Accessing Submissions

All form submissions can be accessed through the Developer Portal UI, programmatically through the API, or exported in different formats. Since submissions are JSON objects, they are easy to use across the entire application environment and elsewhere within the Form.io Platform. The standard nature of JSON makes submissions easily interoperable with many other data management tools and processes.

Refer to the [Accessing Submissions](https://help.form.io/userguide/submissions/accessing-submissions) subtopic for greater detail.

## Importing Submission Data

While all submissions against forms will generate submission objects in that project, many customers may need to migrate data from one project to another, or import data from other systems or elsewhere in their environment.

Refer to the [Importing Submissions](https://help.form.io/userguide/submissions/importing-submissions) subtopic for greater detail.

## Submission Revisions

**Submission Revisions** are a feature that provide audit logging of who has updated a submission, when a change was made, and any notes associated with the update. Additionally, **Submission Revisions** can be used to revert to previous versions while safeguarding all submission data. The Submission Revision feature was introduced in **API Server Version** **7.4.0**. Please note: Submission Revisions are not needed to edit submissions, it is an audit logging capability to track changes that were made.\
\
Please note: Submission Revisions are not needed to edit submissions, it is an audit logging capability to track changes that were made.&#x20;

{% hint style="info" %}
This feature is included in the [**Security and Compliance**](https://help.form.io/developer-tool-ecosystem/the-security-module) package. Follow the link or contact <sales@form.io> for more details.
{% endhint %}

### Enable Submission Revisions <a href="#enable-form-versioning" id="enable-form-versioning"></a>

To get started, create or edit a Form or Resource.

In the **Revisions** section, in the **Submission Revisions** block, expand the select dropdown menu and select **Enable** option.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Flz0HkWgg5k7Audj98pcG%2Fsub1.png?alt=media&#x26;token=1dbb80ab-33d4-489e-a57c-f3a3dac44ed2" alt=""><figcaption></figcaption></figure>

After adding these settings on the tab, each time you make a change to the submission, a new version of it will be created.&#x20;

### View and Updating Submission Revisions

After configuring Submission Revisions, the settings, the **Edit** submission tab has the following form:

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FW1jPRg66yqbwpmNd0sQV%2Fsub3.png?alt=media&#x26;token=de8c6ffd-c239-456a-8f6a-0d2220cf2509" alt=""><figcaption></figcaption></figure>

Use the **Revision Note** field to add a comment to a submission revision.&#x20;

{% hint style="info" %}
A Submission Revision will not be created unless a change is made to the submission
{% endhint %}

Click the **Revision** tab to review all revisions for the submission.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FPD1tmO9XUAMuM7d16Gbw%2Fsubb.png?alt=media&#x26;token=bdb5b592-1341-4416-91a0-d712a6f98ad0" alt=""><figcaption><p>Revision list for the submission</p></figcaption></figure>

Click the **View** button to review a specific revision.

Click the **Restore** button to revert the submission back to that specific version.

### Submission Revision Log <a href="#enable-form-versioning" id="enable-form-versioning"></a>

Generate a PDF output report of all Submission Revision changes made to the submission. To activate the Submission Revision Log, access your **Form Settings**.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F3K00zktuFyie6XixwtPO%2Fformsettings.jpg?alt=media&#x26;token=d4b5c26f-1886-45ab-a0ec-177bf24c9831" alt=""><figcaption></figcaption></figure>

Scroll down to the **PDF Settings** block and check **Show Change Log** option.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FV88uU0QidJf2zevuJkEA%2Fsubc.png?alt=media&#x26;token=831604ba-21c0-4d3b-b6c6-1b159fcd811e" alt=""><figcaption></figcaption></figure>

After this configuration is set, downloading a PDF of the submission pdf file will contain information such as the Revision ID, the User who updated the submission, data and time of the update, submission revision note related to the change, and a list of all revision changes made.

![Submission Revision PDF output log](https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FlIkzSpen8Ezi68FqosRO%2Fsub5.png?alt=media\&token=6421e092-f9de-4b07-bcf4-94465f374c93)

## **Submission Collection**

Enables the storage of submission data within a separate [**database collection**](https://www.mongodb.com/docs/manual/core/databases-and-collections/#collections). These collections can be configured on a per-form basis.

{% hint style="info" %}
This feature is included in the [**Security and Compliance**](https://app.gitbook.com/o/-MPHo8icxg6Muv2awzkA/s/-MPHoF2HwOA0s5HV_AIB/~/changes/345BmpYM6vEKeTFAErxD/developers/security-and-compliance)[ ](https://help.form.io/developer-tool-ecosystem/the-security-module)package. Follow the link or contact <sales@form.io> for more details
{% endhint %}

For read-heavy applications, a database index can be set on fields that are used often for application performance improvements.

Compliance requirements - Ensure data separation between collections.

**Enable Submission Collection**

To configure this feature, navigate to the Form or Resource you want to configure the Collection for and click the form settings button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F3K00zktuFyie6XixwtPO%2Fformsettings.jpg?alt=media&#x26;token=d4b5c26f-1886-45ab-a0ec-177bf24c9831" alt=""><figcaption></figcaption></figure>

If you have an active Security and Compliance package, you will see the Submission Collection field enabled within your settings. Set the collection folder from your database and save your settings.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHgXW3sifu6enqIRhlr6M%2Fcollection1.jpg?alt=media&#x26;token=b6c20674-f3f4-4dab-afe2-01fd580bd35a" alt=""><figcaption><p>Submission Collection field in Form Settings</p></figcaption></figure>

Once active, all data submitted with this Form or Resource will save in the specified database collection.&#x20;
