# Assignment

> Queues of members that pick an owner for new leads, deals or tickets: round robin or weighted, within a territory written as rule conditions, with a log of every pick.

- Category: CRM & sales
- Module: `assignment`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/assignment
- Page: https://bettersupabase.com/blocks/assignment

## Install

```bash
npx better-supabase add assignment
```

The command also installs `updated-at`, `tenant`, `access`, `rules`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by assignment; add installs them too.
    "updated-at": {},
    tenant: {},
    access: {},
    rules: {},
    // Modes: "managed". The default is "managed".
    assignment: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/assignment`.

## Events

- `subject.assigned`

## Related blocks

Requires: [tenant](https://bettersupabase.com/blocks/tenant.md), [access](https://bettersupabase.com/blocks/access.md), [rules](https://bettersupabase.com/blocks/rules.md)

Works with: [outbox](https://bettersupabase.com/blocks/outbox.md), [data-lifecycle](https://bettersupabase.com/blocks/data-lifecycle.md)
