---
title: Form management
---

> **Documentation indexes**
> The indexes below list current page URLs with titles and descriptions. Links on this page point to the Markdown versions of the linked pages.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

List of examples:

## Dependency injection

### Initialize required services

```csharp
// Initializes all services and provider classes used within
// the API examples on this page using dependency injection.
private readonly IBizFormManager bizFormManager;
private readonly IInfoProvider<BizFormInfo> bizFormInfoProvider;

public FormManagementServices(IBizFormManager bizFormManager, IInfoProvider<BizFormInfo> bizFormInfoProvider)
{
    this.bizFormManager = bizFormManager;
    this.bizFormInfoProvider = bizFormInfoProvider;
}
```

[> Back to list of examples](#toc)

## Manage forms

### Move a form to a different workspace

The `Move` method of `IBizFormManager` changes the workspace of the form. If the form is included in any [form submission notifications](https://docs.kentico.com/documentation/developers-and-admins/configuration/notifications.md#form-submission-notifications), moving the form removes it from all of them, because a notification can cover only forms from the same workspace.

The method throws `InvalidOperationException` if the form or the workspace doesn't exist. The method doesn't evaluate workspace permissions.

```csharp
// Gets the form object representing the 'ContactUs' form
BizFormInfo form = await bizFormInfoProvider.GetAsync("ContactUs");

if (form != null)
{
    // Moves the form to the workspace with the 'Marketing' code name
    await bizFormManager.Move(
        new MoveBizFormParameters(form.FormID, "Marketing"));
}
```

[> Back to list of examples](#toc)

### Clone a form

The `Clone` method of `IBizFormManager` creates the clone in the workspace of the original form. The clone contains the same fields, Form Builder layout, contact mapping and settings (such as the submit button text and the contact overwrite option) as the original form. The submitted data, automation processes and autoresponder aren't cloned. To place the clone in a different workspace, [move](#move-a-form-to-a-different-workspace) the cloned form afterwards.

The `Name` property of `CloneBizFormParameters` is optional. If you don't set the property, the code name of the clone is generated from the display name.

```csharp
// Gets the form object representing the 'ContactUs' form
BizFormInfo form = await bizFormInfoProvider.GetAsync("ContactUs");

if (form != null)
{
    // Creates a copy of the form with a new display name and code name
    BizFormInfo clonedForm = await bizFormManager.Clone(
        new CloneBizFormParameters(form.FormID, "Contact us copy")
        {
            Name = "ContactUsCopy"
        });
}
```

**Common errors**

| Error                                | Message                                                                            | Explanation                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------ | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BizFormTableNameNotUniqueException` | `Table named '<table name>' already exists. A unique table name must be provided.` | Another form already uses the code name or table name of the clone. This typically happens when you set the `Name` property to the code name of an existing form. If you don't set the property, the system generates a unique code name automatically. The table name in the message includes the `Form_` prefix that the system adds to the code name. |

[> Back to list of examples](#toc)
