> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Unused Entities

> Identify and archive orphaned forms, automations, and decision tables that have no active references.

The Unused Entities page at `/fw/settings/unused-entities` lists orphan candidate entities — forms, automation rules, and decision tables that appear to have no active references in the dependency graph. Users with the maintain permission can bulk archive selected entities.

## Overview

The Unused Entities page uses `useOrphanReport` to fetch candidate entities for the active organization, filtered optionally by entity type. Each entity is shown in a table with its display name, type badge, status, and creation date. Users with `fw.dependencies.maintain` can select entities and bulk archive them.

Archive operations are performed directly against the database:

* Forms are soft-deleted (`deleted_at` timestamp).
* Automation rules are set to `draft` status.
* Decision tables are deactivated (`is_active: false`).

## Who it's for

Requires `fw.dependencies.view` permission, enforced by `RequirePermission` in `src/routes/fw.tsx`.

The archive action additionally requires `fw.dependencies.maintain` permission (checked via `useHasPermission`). Users without this permission see the list but not the checkboxes or Archive button.

## Before you start

* You must have the `fw.dependencies.view` permission to access this page.
* Review the entity list carefully before archiving. Archiving affects the entity's availability in workflows and submissions.
* Confirm with SME whether archiving is reversible before bulk-archiving large sets.

## Steps

**Reviewing orphan candidates:**

1. Navigate to `/fw/settings/unused-entities`.
2. Use the **Type** filter to narrow results to a specific entity type (Forms, Automations, Decision Tables).
3. Review the table: Name, Type, Status, Created date.

**Archiving entities (requires `fw.dependencies.maintain`):**

1. Check one or more rows using the checkboxes. Use the header checkbox to select all.
2. Select **Archive (N)** in the toolbar.
3. A confirmation dialog shows the count. Select **Archive** to confirm.
4. The selected entities are archived and the list refreshes.

## Key concepts

* **Orphan candidate** — An entity identified as having no active references in the dependency graph. SME: confirm detection methodology.
* **Soft delete (forms)** — Sets `deleted_at` on `fw_forms`; the record remains in the database.
* **Deactivation (decision tables)** — Sets `is_active: false` on `fw_decision_tables`.
* **Draft revert (automation rules)** — Sets `status: 'draft'` on `fw_automation_rules`.
* **Dependency view permission** — `fw.dependencies.view` gates page access; `fw.dependencies.maintain` gates archive actions.

## Related

<Columns cols={2}>
  <Card title="Forms & Workflow" icon="diagram-project" href="/fw/overview">
    Forms & Workflow core overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index" />
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/fw\.tsx
  * src/cores/fw/pages/UnusedEntitiesPage.tsx
  * src/cores/fw/hooks/useOrphanReport.ts
  * src/cores/fw/types/dependencyGraph.ts
</Accordion>
