# Deal methods: advance, assign, lose

URL: /code/sdk/deal/verbs · Id: `page:code/sdk/deal/verbs`

> The Deal Verbs advance, assign, lose as typed SDK methods, with inputs, result, refusals and an example.

Reference for [Deal](/business/nouns/deal), one group of [Deal methods](/code/sdk/deal).

### Deal.advance
Advance moves a Deal to its next stage once every field that stage requires is filled. [Verb page](/business/nouns/deal/advance?interface=sdk).

```ts
interface DealVerbs {
  advance(input: DealAdvanceInput, options?: SB.CallOptions): SB.Call<Deal>
}
```

Emits [`Deal.advanced`](/business/events/Deal.advanced).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The Deal. |
| `stage` | `string` | No | The target stage; omitted, the next one. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The Deal in its new stage. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const deal = await $.Deal.advance({ deal: 'deal_NgACZ6DcII' })
```

### Deal.assign
Assign gives a Deal one owner Worker, who carries its next step until it is won or lost. [Verb page](/business/nouns/deal/assign?interface=sdk).

```ts
interface DealVerbs {
  assign(input: DealAssignInput, options?: SB.CallOptions): SB.Call<Deal>
}
```

Emits [`Deal.assigned`](/business/events/Deal.assigned).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The Deal. |
| `owner` | [Worker](/business/nouns/worker) | No | The Worker to own it; omitted, the routing Policy picks. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The Deal, with its owner. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const deal = await $.Deal.assign({ deal: 'deal_NgACZ6DcII' })
```

### Deal.lose
Lose closes a Deal as lost and records the reason the buyer gave. [Verb page](/business/nouns/deal/lose?interface=sdk).

```ts
interface DealVerbs {
  lose(input: DealLoseInput, options?: SB.CallOptions): SB.Call<Deal>
}
```

Emits [`Deal.lost`](/business/events/Deal.lost).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The open Deal. |
| `reason` | `text` | Yes | Why the buyer passed. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `deal` | [Deal](/business/nouns/deal) | Yes | The lost Deal. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const deal = await $.Deal.lose({ deal: 'deal_NgACZ6DcII', reason: 'Example reason' })
```