# Create a decision tree

## Creation

1. Click the following button: <img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2Fmn7yiSagYrFnG417FOzN%2Fimage.png?alt=media&#x26;token=e77e29e9-7995-4de0-86ee-d83a9d5f224a" alt="" data-size="line">
2. Give it a name and click "**Validate**"
3. To complete or modify it, click "**View details**"

You will be redirected to the following interface:

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FwN7Dhh2B8LT79NxpnDUb%2Fimage.png?alt=media&#x26;token=2fab4fdb-9749-4bb2-b39d-09b03154e92f" alt="" width="563"><figcaption></figcaption></figure>

1. This box represents your first node. When completed, it contains a step name and associated content. The node visualisation, in the upper part with a gray background, allows you to find your way around the decision tree and navigate easily.
2. In the lower part of the screen, you will find the edit fields for each node.
   * **Step Name**: A brief description of the step's content. For example, if the question is "How do I log in to my CogNeed account?", the step name would be "Login."
   * **Content**: A sentence to read, information to consider, or a question to ask by your user at this step. To find content customisation elements, go to the article [create-edit-a-content-card](https://cogneed.gitbook.io/cogneed-centre-daide/cogneed-help-center/dashboard/content-management/project/content-cards/create-edit-a-content-card "mention")
   * **Destination(s)**: Possible branches at this step. You can add one or more destinations per node by clicking "Add a destination." Each destination has a value, which the user will have to click on to move to the next step: yes/no, 3/4/5, Product1/Product2, ...

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FUzcmLmdSW0MdedYpIMn2%2Fimage.png?alt=media&#x26;token=02bf7b9a-4f9b-4477-890b-9397d8781d0c" alt="" width="563"><figcaption></figcaption></figure>

## Insert an existing branch

1. Go to the node where you want to insert an existing branch.
2. Click "**Insert an existing branch**."
3. Click on the node you want to insert (all subsequent nodes will also be inserted).
4. Give this new destination a value and enable or disable synchronisation.\\

   <figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2F22LcJfBKNCZlVQl216Bp%2Fimage.png?alt=media&#x26;token=a0881fdb-a869-4200-89d5-f0ba0c2aefd8" alt="" width="452"><figcaption></figcaption></figure>
5. Click "**Save**."

{% hint style="success" %}

* An insert without synchronisation allows you to duplicate the selected branch without creating a link between the two.
* An insert with synchronisation allows you to automatically update the inserted branch when the original branch is updated, and vice versa.
  {% endhint %}

## Delete a node

You can only delete nodes that have no "children." Once a destination has been added, it must first be deleted, along with all nodes that descend from it, before the original node can be deleted.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FS2EnvKrBAVSUIugpqOYd%2Fimage.png?alt=media&#x26;token=e0f792fd-3a9e-451a-8f8b-1ee8ac85416e" alt="" width="563"><figcaption></figcaption></figure>

## Finalise a tree

Once your decision tree is finalised, check the "Mark as leaf" box on the end nodes of your different branches.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FPDmCfxoMyR4y3YEPybFI%2Fimage.png?alt=media&#x26;token=0100860a-d20f-4e96-b8c6-f2a15d127289" alt="" width="271"><figcaption></figcaption></figure>

## Preview

At any time, you can preview your changes and test your decision tree by clicking the "**Preview**" button at the top right of the screen.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FmBGHUXCFKWC37dmy3O9M%2Fimage.png?alt=media&#x26;token=c851d9aa-06dd-480a-9d42-2f2443d3ae8e" alt=""><figcaption></figcaption></figure>
