# M365: Build Org Chart Crate

{% hint style="info" %}
If you’re new to Crates, read through our introductory Crate documentation [here](https://docs.rewst.help/prebuilt-automations/crates). Find the Crate in our Crate Marketplace.
{% endhint %}

## What does the M365: Build Org Chart Crate do?

Automatically generate an organizational chart from Microsoft 365 user data with the M365: Build Org Chart Crate. Referencing the manager and job title fields, it produces an HTML diagram that helps visualize reporting relationships across the organization. This is particularly useful for HR, IT, and leadership teams managing structure or onboarding processes. The Crate uses a bundled HTML template to render the org chart. Basic customization, such as layout or styling, can be applied by editing this template.

* **Retrieve user directory data**: Fetch users from Microsoft Graph, including each user's job title and assigned manager.
* **Filter disconnected users**: If `include_isolated_users` is set to false, it excludes users without a manager or who are not a manager themselves, focusing the chart on connected hierarchies.
* **Generate org chart code**: Constructs a diagram using Mermaid.js syntax to represent organizational relationships visually.
* **Build HTML page**: Embeds the Mermaid.js org chart into an HTML template.
* **Send notification email**: Emails the user a link to access and view the generated org chart.

{% hint style="warning" %}
The generated chart reflects a snapshot in time and does not auto-update as org structure changes.
{% endhint %}

## Crate prerequisites

Before unpacking this Crate, you'll first need to set up the Microsoft Graph integration, via our [Microsoft Cloud Bundle](https://docs.rewst.help/documentation/integrations/integration-guides/microsoft-cloud-integration-bundle).

## Unpack the M365: Build Org Chart Crate

1. Navigate to **Marketplace > Crates** in the left side menu of the Rewst platform.
2. Search for `M365: Generate Org Chart`**.**\
   \
   ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FprmZ3jwBz3KMDUGSxdHF%2Fimage.png?alt=media\&token=10ebb80e-67b6-4d2e-baa3-2dde8be0c976)
3. Click on the Crate tile to begin unpacking.
4. Click **Unpack Crate**.
5. Click **Continue**.
6. Note that you have the option under the **Webhook** and **Form Submission** accordion menus to activate the Crate for all future organizations in addition to the current one. Current org-only is the default. You may also set activation to certain [tags](https://docs.rewst.help/documentation/settings/tags-in-rewst).&#x20;
7. Click **Unpack Crate**.

### Use the form

{% hint style="info" %}
The Crate workflow is triggered by a form submission. Initiate the org chart generation by submitting a request through the form with the necessary inputs.
{% endhint %}

1. Navigate to **Automations > Assets > Forms**.
2. Locate the form titled **Microsoft: Build Org Chart**.<br>

   <figure><img src="https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2Fe5NkrYlBpTUNFRMcGvOv%2FScreenshot%202025-05-08%20at%205.51.59%E2%80%AFPM.png?alt=media&#x26;token=a9245e3b-3f18-49ee-a6fc-b69b54bb3918" alt=""><figcaption></figcaption></figure>
3. Click **⋮ > Usages**.
4. Click **View Direct URLs**.
5. Click on the link in the dialog that appears.
6. Fill out the form as desired.\
   \
   ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2FcaC6ngdLIS3qmRsByZ65%2FScreenshot%202025-05-08%20at%205.55.06%E2%80%AFPM.png?alt=media\&token=b878c961-4875-4274-ab65-eab1b26f970b)
7. Click **Submit**.
8. Check the email specified in your form submission for the receipt of the chart.

### Edit the email template

1. Navigate to **Automations > Assets > Templates**.
2. Search for `Org Chart HTML Template`**.**\
   \
   ![](https://1835401289-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAQQ1EHVcEsGKBPVHmiav%2Fuploads%2F2WKNtm2vKTWXVzuyGK16%2FScreenshot%202025-05-08%20at%205.57.56%E2%80%AFPM.png?alt=media\&token=e70f4be1-fc86-4dfa-a937-8097e6e1dcb1)
3. Click **>** to open and edit the template.&#x20;

{% hint style="info" %}
Got an idea for a new Crate? Rewst is constantly adding new Crates to our Crate Marketplace. Submit your idea or upvote existing ideas here in our [Canny feedback collector](https://rewst.canny.io/crates).
{% 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://docs.rewst.help/documentation/crates/existing-crate-documentation/m365-generate-org-chart-crate.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.
