# Field Hierarchy Sync

### Overview

From the cog menu (<img src="/files/jVHo2mJdPPYgURipegQV" alt="" data-size="line">) located next to the Add Country button, Admins can upload a .csv with Field Structure information for bulk site uploading. Admins also have the option to download the current Field Structure hierarchy in the form of a .csv. MangoApps supports full automation of your organizational field structure.

<figure><img src="/files/7vxsB60QVmbjvgq4hTpF" alt="" width="563"><figcaption></figcaption></figure>

***

### Automate Import (sFTP)

Connect MangoApps to an sFTP server where your field structure file is hosted.

<figure><img src="/files/Wo35MqnF45JEw1GiAOw9" alt="" width="563"><figcaption></figcaption></figure>

The automation process supports creation, updates, and removal of elements in your field hierarchy, including Countries, Divisions, Regions, Districts, and Stores.

The automation is flexible and supports a variety of structural changes:

* Moving stores between districts
* Moving districts between regions
* Moving regions between divisions
* Renaming divisions, regions, and districts

{% hint style="warning" %}
The **Country** level **must** already exist under **Domain > Locations** in MangoApps before using this automation.
{% endhint %}

***

### Bulk Upload (CSV)

The **Bulk Upload of Field Structure** feature allows admins to quickly update your entire field structure using a CSV file. This is useful for initial setup or making large-scale changes across multiple sites and fields.

<figure><img src="/files/dmnXAmprOtLrV7gEtgXi" alt=""><figcaption></figcaption></figure>

Click the **Browse** button to upload your CSV file.

The system will **fully replace the existing field structure** with the structure defined in the uploaded CSV.

To ensure a successful upload, your CSV file **must include the following columns** in the exact order and format.

| Column Name          | Description                        |
| -------------------- | ---------------------------------- |
| Country              | Name of the country                |
| Country External ID  | Unique identifier for the country  |
| Division             | Name of the division               |
| Division External ID | Unique identifier for the division |
| Region               | Name of the region                 |
| Region External ID   | Unique identifier for the region   |
| Area                 | Name of the area                   |
| Area External ID     | Unique identifier for the area     |
| Location             | Name of the location               |
| Location External ID | Unique identifier for the location |

{% hint style="danger" %}
**Do not modify, remove, or reorder the column headers.** Any changes to the column names or structure will result in upload failure.
{% endhint %}

To get started, you can Download Sample CSV to see the correct format.

{% hint style="warning" %}
Before uploading, ensure your CSV includes **all** current field data. Any field not listed in the CSV will be deleted during the upload process.
{% endhint %}

***

### Export (CSV)

You can export your current field structure to use as a starting point for edits and re-imports (either via automation or manual upload).

<figure><img src="/files/Akf7Fo9Vj7SwRPUGAFgI" alt=""><figcaption></figcaption></figure>

***

### Import/Export User Automation Rules (CSV)

Managing user assignment rules across your field hierarchy is made easy with the **Import/Export User Automation Rules** feature. This tool allows you to efficiently configure automation rules in bulk using a CSV file or through the UI.

Choose from three methods to manage user automation rules:

* **Bulk Import:** Upload a CSV to create or update multiple automation rules at once.
* **Bulk Export:** Download existing automation rules for review or batch editing.
* **UI-Based Editing:** Manually create or update rules in the interface using the intuitive filter conditions box.

Your CSV file must include the following columns **in the exact order** listed below:

| Column Name          | Description                                         |
| -------------------- | --------------------------------------------------- |
| Site ID              | Unique internal identifier for the site             |
| Country External ID  | External ID of the country                          |
| Division External ID | External ID of the division                         |
| Region External ID   | External ID of the region                           |
| Area External ID     | External ID of the area                             |
| Site Name            | Name of the site                                    |
| Automation Trigger   | The event or condition that triggers the automation |
| Automation Rule      | The rule defining which users should be assigned    |

{% hint style="danger" %}
Do **not** change the column headers. Any changes to column names, order, or structure will result in a failed upload.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.mangoapps.com/admin-guide/domain-settings/field-structures/field-hierarchy-sync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
