﻿# Versioning of structures in BRIX

> [HTML Version](elma365-structure-versioning.html)

Versioning support allows you to create a version history of a structure and restore a previous configuration, for example, if an error occurs in the current version.

In BRIX, versions are created for the following structures:

- workspace page;

- app and its page;

- [contract](contract.md) and its page;

- [Report](report.md) component;

- form template in interface designer;

- business process.

````
начало внимание

````
To enable version saving for system structures, turn on the  \[OBJECT\] feature flag. For more details, see [Modify BRIX parameters](change-settings-enterprise.md#enable-feature-flag-enterpeise). If you are using the SaaS edition, contact your BRIX account manager to enable the feature flag.

````
конец внимание

## ````
When a structure version is created

A new version of a structure is automatically created in the following cases

1. when you save changes to the settings listed in the table below.

| | |
|------|------|
| **Structure** | ** Settings that trigger version creation ** |
| Workspace page | [Workspace settings](360006965372.md). |
| App | - Registration (for **Document**-type apps);<br>- Form settings;<br>- App settings (specific options);<br>- App item name;<br>- Hierarchical folder;<br>- Status field;<br>- [Counter](360007529451.md#change-settings) (specific options);<br>- Signature settings;<br>- Archiving settings;<br>- Print form. |
| App page | App settings (specific options).<br>For details on which options create a version of an app or its page, see [General app settings](360007708691.md#version-history). |
| Contract and its page | - Contract settings;<br>- Contract fields;<br>- Changes in source apps if a new version of an app is created.<br>For details on which options create a version of a contract or its page, see [Contract settings](contract-settings.md#version-history). |
| Report | - Report settings;<br>- Source settings;<br>- Table settings.<br>For details on which options create a report version, see [Create and configure a report](create-report.md). |


2. When you publish changes to an app form or a widget in the interface designer. If a task form in a business process is edited, its new version will be added without an author comment after the process is published

3. When a process is published in process designer.

4. When you import or update a workspace or solution and the settings of the loaded structure version differ from its current version.

The first version is saved when a structure is created or when changes are saved for the first time in any setting of an existing structure.

Example of creating a version of an app

1. To the right of the **Contracts** app name, click the gear icon and select **Form settings**.

2. On the page that opens, add a new property, for example **Contractor submission date**.

3. Save the form settings. A window will appear showing the version number of the app that will be created.

4. Add a comment and click **Save**.

**(structure_versions_00.PNG)**

For details on how variables are stored in app version contexts, see [Context tab](360028941112.md).

## Structure version history

You can view the version history, compare versions, download a version as a .**e365** file, restore a previous version, and more. To open the version list:

1. **For a workspace page**, in the settings menu select **Additional > Page Version History**. This stores the history of changes made in the [Workspace Settings](360006965372.md) window.

2. **For an app and its page**, in the app settings menu select **Additional > Version History**:

-  the **App** tab contains all app versions;

- the **Page** tab contains page versions, which are created independently of app versions and store the history of changes to [specific app settings](360007708691.md#version-history).

**(structure_versions_01.PNG)**

3. **For a contract and its page**, in the contract settings menu, select **Version History**:

- the **Contract** tab contains all contract versions;

- the **Page** tab contains contact page versions, which are created independently of contract versions and store the history of changes to [specific contract settings](contract-settings.md#version-history).

4. **For a report**, in the report settings list, select **Additional > Version History**.

5. **For a form template**, in the interface designer, open the **History** tab. This tab stores all published and unpublished versions of the form or widget.

6. **For a business process**, in the business process designer, go to **Settings > Version History**. All published process versions are stored here.

The current structure version is marked with the  **[![elma365-structure-versioning-3](elma365-structure-versioning-3.png)] icon**. You can view the date and author of the changes that created the version, as well as the comment. If a structure version is created during import or update, the comment is generated automatically and indicates the performed action: **Import** or **Update**.

## Actions with structure versions

To open the available actions menu for a version, select it in the list and click the three-dot icon. You can:

- [Compare with Current Version](#compare-with-current) to view the previous and current versions in JSON format.

- **Download File** to download the version as a .**e365** file. These files can be compared in an external text editor, such as Visual Studio Code.

- **Delete Version** is available only for previous versions. Allows you to clean up the history and permanently delete unnecessary versions. Not applicable to forms, widgets, or business processes.

- **Unpublish** is used for published versions of forms and widgets.

- **Restore Version**  makes one of the previous versions the current one. For example, if an error occurs and you do not have time to fix it, you can roll back the current version. A new version will be created.

## Compare strucure versions

To view the differences between versions:

1. In the row of the target version you want to restore, click the three-dot icon and select **Compare with Current Version**.

2. A **side-by-side** tab opens displaying the contents of both versions in JSON format. Differences are highlighted in color.

**(structure_versions_02.PNG)**

3. You can also display only the differences between versions. To do this, switch to the **inline** tab: content of the current version is highlighted in red; content of the target version is highlighted in green.

**(structure_versions_03.PNG)**

4. To make the target version current, click **Restore Version** on any tab.