# Subfolder Structure

With the subfolder structure feature, existing folders and files in SharePoint can be conveniently duplicated or replicated by simply configuring the path of the main folder in the Entity configuration.

This feature is highly versatile and can be used in various scenarios:

* **Policy and Document Management:** Create a folder with subfolders containing different documents such as policies, product assets, terms and conditions, and more. This ensures organized and efficient document management.
* **Onboarding New Customers or Team Members:** An executive can easily duplicate a structured folder in SharePoint for newly onboarded customers or new team members. This can include a sheet of Points of Contact (POCs), training materials, and other essential documents.

The possibilities are endless, providing a streamlined approach to managing and replicating folder structures and their contents within SharePoint.

{% hint style="info" %}
**Note:** This feature is applicable when the document location is created in the CRM, this gets created in the following ways – Attach2Dynamics UI, Real-time, Bulk Migration Job, Auto-create folder structure, documents, or files tab.
{% endhint %}

**Configuration:**

To replicate folders and files in SharePoint using the subfolder structure feature, follow these steps:

**Navigate to SharePoint Security Sync’s Entity Configuration:**

* Go to **Entity Configuration** and select **Account**.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2Fp5AezFT0DDBwix16qA07%2F1.png?alt=media&#x26;token=7c883a06-1a8e-4fc3-a9fe-956b834a88e7" alt=""><figcaption></figcaption></figure>

• Open the Create **Custom Folder Structure tab**. Here, you will find the **Subfolder Template Path** field.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F26yE8AXClSiKRhylK3Xb%2F2.png?alt=media&#x26;token=6a8d5457-686a-4caa-879c-673d5c16c898" alt=""><figcaption></figcaption></figure>

**Set the Subfolder Template Path:**

* **Copy** the title of the main folder you want to replicate by default.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FM4t0eTizl9Jq0NgFLEDq%2F3.png?alt=media&#x26;token=bd7f9e40-8164-479a-b994-33a4101c1cfc" alt=""><figcaption></figcaption></figure>

* **Paste** the folder title inside the **Subfolder Template Path** field.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F7VbJuXthyXqmA8JWyyCW%2F4.png?alt=media&#x26;token=b49ae226-3e16-4f5f-9828-eaa73c604bcd" alt=""><figcaption></figcaption></figure>

* Click **Save** to save the configuration.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FInFoIssbuPpJuHRIbWAG%2F5.png?alt=media&#x26;token=00cf4ddb-75f4-4159-a05a-b03e53648c79" alt=""><figcaption></figcaption></figure>

**Example Using Attach2Dynamics UI:**

* When the user clicks on **Attach2Dynamics**, a document location is created in the background.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FaTHlmo0huPbGY8PdCPf7%2F6.png?alt=media&#x26;token=6a41d902-8d53-4535-8e2b-a19d522b10c5" alt=""><figcaption></figcaption></figure>

* The configuration then creates a copy of the files and folders inside the configured folder

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FHkqlSWgd5aXGx25wBR7a%2F7.png?alt=media&#x26;token=13725e9b-b2db-4f9d-9f55-875cd8e09d73" alt=""><figcaption></figcaption></figure>

* As shown in the screenshot, folders, and files are replicated by default.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2Fe1QIZ8lgWWADTEFHNk3Z%2F8.png?alt=media&#x26;token=953997ae-c510-4bc4-b7e9-a311c8ef7814" alt=""><figcaption></figcaption></figure>

* This link redirects to the replicated SharePoint Folder.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2Fdi8CEwMTVKcRiYrSY6fv%2F9.png?alt=media&#x26;token=808b6f9c-0369-477d-9224-87b7e199aa00" alt=""><figcaption></figcaption></figure>

This process ensures that the folder structure, along with its contents, is conveniently duplicated in SharePoint.

## Sub-Folder Template Path Support (FetchXML-Based)

This feature enables automatic creation of a folder structure in SharePoint based on conditions defined using FetchXML. Whenever a Dynamics 365 record meets one of the configured conditions, the system replicates a pre-defined SharePoint template folder structure under that record’s SharePoint location. A default template can also be configured to handle cases where no condition matches.

&#x20;This feature is highly versatile and can be used in various scenarios:

* Helps create different folder templates based on business requirements such as region, department, customer type, or any CRM field.
* Ensures the right template is automatically applied to each record.
* Allows organizations to maintain standardized folder structures across records while still supporting variations needed for different business scenarios.

&#x20;

&#x20;

Configuration:

&#x20;

1\.     Go to Entity Configuration and select Account<br>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FSpCLjwkfN2CRSbxqBEF9%2Fimage.png?alt=media&#x26;token=a00aaa19-0063-4e75-a181-0a50ecc54d7c" alt=""><figcaption></figcaption></figure>

2\.     Open the **Create Custom Folder Structure** tab.\
In the **Subfolder Template Path** section, click on **New Sub Folder Template Path**.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FyuKAjruOnk1a7FjMQ9Xn%2Fimage.png?alt=media&#x26;token=ae9d7b43-25a5-4201-ad4f-7da222391ee1" alt=""><figcaption></figcaption></figure>

3\.     In the **FetchXML** field, enter the condition that determines when the folder template should be applied.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FQM8ezMdna0hAtOgAmDnz%2Fimage.png?alt=media&#x26;token=c6b496c7-8eaa-4e01-9fe6-ecd8d32867c6" alt=""><figcaption></figcaption></figure>

4\.     Copy and paste the **SharePoint Template Path**.\
This represents the folder structure that will be replicated when the FetchXML condition is met.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FMSf2KuS9SQB65vNHWsxo%2Fimage.png?alt=media&#x26;token=2fd2acec-e192-439d-9a81-b91b6431ffd4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FgTkhF002SPzbCSHVwNWU%2Fimage.png?alt=media&#x26;token=bddaf581-a383-4282-875e-4e200473117e" alt=""><figcaption></figcaption></figure>

5\.     Click **Save and Close**.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F4Q4eVVJKoY3DK2IwGU6u%2Fimage.png?alt=media&#x26;token=216296f0-dba5-45b7-bf41-59aa3f5f2d33" alt=""><figcaption></figcaption></figure>

6\.     This step is optional. Configure a **Default Template Path** to be used when none of the FetchXML conditions match.<br>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FXNPzmrYEfTDPN0pBRloT%2Fimage.png?alt=media&#x26;token=c0f31cc6-844d-4cd5-b080-8ca4b74c90a4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F62WgEP9Dp0RF7HO6ioU9%2Fimage.png?alt=media&#x26;token=819635fe-6611-455b-9608-22cb78b65bf0" alt=""><figcaption></figcaption></figure>

7\.     Click on **Save** to save the configuration.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2F4ZpmQuBCBomaluZKiT0D%2Fimage.png?alt=media&#x26;token=b7cb3073-728a-4cd9-bafc-5b872ef08f17" alt=""><figcaption></figcaption></figure>

**Example using Attach2Dynamics UI:**

1\.     A user creates a new record in the CRM when the address entered is USA.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2Fh6EEdvt4xBO7GzmBdkYd%2Fimage.png?alt=media&#x26;token=e1e45e2d-a85d-45bf-9fb4-44f5fd688004" alt=""><figcaption></figcaption></figure>

2\.     When the record is saved and the user clicks on **Attach2Dynamics**, the configured FetchXML condition is evaluated in the background.<br>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FR0rwY51yl4Zwz9ugYKFR%2Fimage.png?alt=media&#x26;token=0207f66e-dc84-415f-ad99-c2811dd6863a" alt=""><figcaption></figcaption></figure>

3\.     If the condition matches, the system automatically creates a copy of the configured SharePoint folder and file structure under the record’s SharePoint location.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FQOb5QER5eyckwB907e4v%2Fimage.png?alt=media&#x26;token=c3fdc0da-ee08-49b5-bcbc-23cd33b2730e" alt=""><figcaption></figcaption></figure>

4\.     This link redirects to the replicated SharePoint Folder.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FzlMRjwRwRhid43UW6zPC%2Fimage.png?alt=media&#x26;token=163504bf-1fb4-4c6c-a23a-be883cbfee75" alt=""><figcaption></figcaption></figure>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FBmwXD90Lbk9jWIvg1kse%2Fimage.png?alt=media&#x26;token=9dcf435e-ab62-4520-ae08-3cc73c669092" alt=""><figcaption></figcaption></figure>

5\.     If a **default template path** is configured, and the user creates a record where the Address field contains **“English”** or is left empty, the default folder structure is automatically applied instead.

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FnT41HtY4wFtzogkKBkt7%2Fimage.png?alt=media&#x26;token=0faa4096-dbcb-42b3-aa87-9c5dc4be3a00" alt=""><figcaption></figcaption></figure>

<figure><img src="https://272130504-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0QoyqUVI8_HaZ9FOSL%2Fuploads%2FKUZyk7t3jU7kFi6wEWrR%2Fimage.png?alt=media&#x26;token=3b14ed88-aef2-4fed-a6c6-a47ba8c24a11" alt=""><figcaption></figcaption></figure>

&#x20;
