# Delete a department or team

## Overview

[Video: Delete a department or team](https://www.youtube.com/watch?v=PT3AZUeqf4w)

This flow describes how to delete a [department](https://docs.ohc.network/concepts/facility/department.md) or a team from a facility. Care deletes a department only when it has no sub-departments and no other members, no encounter or location is linked to it, and it manages no devices.

## Pre-requisites

* You have a role in a department of the facility, or in its root department, "Administration". The facility then shows on the **Facilities** tab of your dashboard.
* The department is not "Administration".
* The department has no sub-departments. If it has sub-departments, delete them first.
* The department has no members other than you. Service accounts count as members. To remove a member, see [Change or remove a user's role](https://docs.ohc.network/flows/access-governance/access-control/change-or-remove-user-role.md) and [Change a service account's role or remove it](https://docs.ohc.network/flows/access-governance/service-account/change-or-remove-service-account.md).
* No encounter and no location is linked to the department, and the department manages no devices.
* You have the permissions listed below.

## Permissions

| Permission | Access |
| - | - |
| Can View Facility Organizations | Shows the departments of the facility, so that you can find the department. Hold it in any department of the facility, or in "Administration". Without it, Care shows no departments. By default, the Facility Admin, Administrator, Staff, Doctor, Nurse and Volunteer roles hold it. |
| Can Manage Facility Organizations | Shows the **Delete** icon. Hold it in any department of the facility, or in "Administration". |
| Can Delete Facility Organizations | Lets you delete the department. Hold it in that department, a department above it, or "Administration". To delete from the screen, you need this permission and "Can Manage Facility Organizations". By default, the Facility Admin role holds both. |

## Steps

### 1. Find the department

On your dashboard, select the **Facilities** tab. Then select the facility.

In the facility sidebar, select **Settings**. Then select **Departments** in the settings sidebar.

* For a top-level department, find its row in the list on the **Departments/Teams** page.
* For a sub-department, select the row of its parent department. Care opens the **Departments/Teams** tab of the parent, with its sub-departments.
* To go further down the tree, select the row of the next department.
* On a narrow screen, each department shows as a card. Select **See Details** to open it.
* To filter the departments at this level by name, type in **Search by department/team name**.

A folder icon with the tooltip **Has child organizations** shows that a department has sub-departments. Delete those sub-departments first.

![The Care screen at the step: Find the department](/assets/images/delete-department-1-4978c51e20983b7a00de2bb6d9ceddc6.webp)

### 2. Select Delete

In the row of the department, select the **Delete** icon in the **Actions** column.

On a narrow screen, select the **Delete** icon on the card of the department.

Care shows **Delete** only for a department that has no sub-departments and is not "Administration". If you still do not see **Delete**, your roles in the facility do not have "Can Manage Facility Organizations".

![The Care screen at the step: Select Delete](/assets/images/delete-department-2-48770f5a962964385b6eb9283f3320bf.webp)

### 3. Confirm the deletion

Care asks you to confirm that you want to delete the department. Select **Remove**.

Care shows **Organization deleted successfully**.

Care checks these cases in the order below. If a case applies, Care does not delete the department. It shows the message for the first case that applies.

| Message | Why Care refuses, and what to do |
| - | - |
| "Cannot delete root organization" | The department is "Administration". You cannot delete it. |
| "Cannot delete organization with children" | The department has sub-departments. Delete them first. |
| "Cannot delete organization with users" | The department has members other than you. Service accounts count as members. Remove the other members first. |
| "Cannot delete organization with encounters" | An encounter is linked to the department. See [Manage encounter departments](https://docs.ohc.network/flows/clinical/encounter/manage-encounter-departments.md). |
| "Cannot delete organization with locations" | A location is linked to the department. See [Manage a location's organizations](https://docs.ohc.network/flows/facility/location/manage-location-organizations.md). |
| "Cannot delete organization with devices" | The department manages a device. |
| "User does not have the required permissions to delete this organization" | Your roles do not have "Can Delete Facility Organizations" in this department, a department above it, or "Administration". |

![The Care screen at the step: Confirm the deletion](/assets/images/delete-department-3-72a3cfd0ffc7e56bbc0db4daa7852fda.webp)

## Expected Outcome

* Care deletes the department and shows **Organization deleted successfully**.
* If you were a member of the department, Care also removes your membership.

## Related

Concepts:

* [Department](https://docs.ohc.network/concepts/facility/department.md)
* [Facility organization](https://docs.ohc.network/concepts/access-governance/facility-organization.md)

Flows:

* [Create a department or team](https://docs.ohc.network/flows/facility/department/create-department.md)
* [Edit a department or team](https://docs.ohc.network/flows/facility/department/update-department.md)
* [Add users to a department](https://docs.ohc.network/flows/facility/department/add-users-to-department.md)
* [Change or remove a user's role](https://docs.ohc.network/flows/access-governance/access-control/change-or-remove-user-role.md)
* [Change a service account's role or remove it](https://docs.ohc.network/flows/access-governance/service-account/change-or-remove-service-account.md)
* [Manage encounter departments](https://docs.ohc.network/flows/clinical/encounter/manage-encounter-departments.md)
* [Manage a location's organizations](https://docs.ohc.network/flows/facility/location/manage-location-organizations.md)
