# Assign invoice tenant (multi-entity routing)

Route invoices to the correct tenant in multi-entity inboxes.

Route incoming payables from a **shared import mailbox** to the correct **child workspace** before matching and approval, so one inbox can serve a group of legal entities.

**Who this is for:** Group AP teams and admins who receive invoices at a parent tenant and must land each document on the entity that owns the booking (different DATEV Mandanten, charts, or workflows).

## 1. Add and configure Assign invoice tenant

1. Open **Workflow Configuration** for **Payables** on the tenant that receives imports (often the **parent** or shared inbox tenant).
2. Add **Assign invoice tenant** early in the flow, typically **after extraction** and **before** matching or entity-specific approval.
3. Add **rules** top to bottom; processing **stops at the first match**.

For each rule, choose:

| **Field** | **Matches on** |
| --- | --- |
| **Recipient address country** | Country on the invoice recipient address |
| **Recipient company name** | Legal name on the recipient block |
| **Recipient company name and address country (both)** | Both must match (AND) |
| **Recipient company name and supplier name (both)** | Recipient and supplier patterns (AND) |

Then set **Target tenant** to the workspace where the invoice should be processed.

**Patterns** · One pattern per line. Use `*` and `?` wildcards; backslash escapes literals. Example company patterns: `Acme*`, `Example GmbH`. Country patterns: `DE`, `AT`, `CH`.

Drag rules by the handle to reorder. Users who edit the node must have access to **every target tenant** listed; otherwise the step is locked until an admin updates it.

## 2. What happens when a rule matches

When an imported invoice hits this step:

1. Cortena evaluates rules in order.
2. On the first match, the invoice is **assigned** to the **target tenant** for the rest of processing (matching, workflow, export).
3. If no rule matches, the invoice stays on the **import tenant**. Add a catch-all rule or a **Condition** on **Invoice tenant** for exceptions.

Invoices already on a child tenant are not moved backward by this step unless your flow explicitly routes them again.

## 3. Typical multi-entity inbox layout

```text
Import (parent mailbox)
  → Assign invoice tenant
  → Condition (optional: Invoice tenant / document type)
  → Review / Approval (per-entity workflow on child)
  → Export to accounting
```

Use **Invoice tenant** in **Condition** branches when different entities need different paths after routing.

## Tips and limitations

- **Payables workflows only**. This node is not available on receivable or expense graphs.
- Extraction uses the **import mailbox tenant**; routing rules are loaded from the effective workflow definition (parent when workflow inheritance is enabled).
- Target tenants must be workspaces your publishing user can access.
- For tag-based routing after entity assignment, combine with [Assign invoice tags](https://help.cortena.ai/guides/workflows/assign-invoice-tags) and **Invoice tags** conditions.

## Quick reference

| **Task** | **Where** |
| --- | --- |
| Configure routing | **Workflow Configuration** → **Assign invoice tenant** |
| Reorder rules | Drag handle on each rule row |
| Match recipient country | Rule → **Recipient address country** |
| Match legal entity name | **Recipient company name** patterns |
| Branch after routing | **Condition** → **Invoice tenant** |
| Verify landing tenant | Invoice detail + tenant selector / list filter |
