Skip to content

Deal methods: advance, assign, lose

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

Reference for Deal, one group of Deal methods.

Deal.advance

Advance moves a Deal to its next stage once every field that stage requires is filled. Verb page.

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

Emits Deal.advanced.

Inputs

InputTypeRequiredDescription
dealDealrequiredThe Deal.
stagestringThe target stage; omitted, the next one.

Returns

OutputTypeRequiredDescription
dealDealrequiredThe Deal in its new stage.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
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.

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

Emits Deal.assigned.

Inputs

InputTypeRequiredDescription
dealDealrequiredThe Deal.
ownerWorkerThe Worker to own it; omitted, the routing Policy picks.

Returns

OutputTypeRequiredDescription
dealDealrequiredThe Deal, with its owner.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
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.

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

Emits Deal.lost.

Inputs

InputTypeRequiredDescription
dealDealrequiredThe open Deal.
reasontextrequiredWhy the buyer passed.

Returns

OutputTypeRequiredDescription
dealDealrequiredThe lost Deal.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse 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.refusedRead the record, run the Verb that moves it to an allowed state, then retry.None.

Example

TypeScript
import { $ } from 'startup-builder'

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