# Class Trigger

Trigger class

#### Hierarchy

- Trigger

#### Implements

- AbstractTrigger

- Defined in saltcorn-data/models/trigger.ts:36

#####
Index

### Constructors

constructor

### Properties

action
channel?
configuration
description?
id?
min_role?
name?
run?
table_id?
table_name?
when_trigger

### Accessors

toJson
abbreviated_actions
when_options

### Methods

clone
delete
getTags
runWithoutRow
action_options
create
emitEvent
find
findAllWithTableName
findDB
findOne
getAllTableTriggers
getTableTriggers
hasTableTriggers
runTableTriggers
sendEventToServer
setRunFunctions
state_refresh
trigger_actions
update

## Constructors

### constructor

- new Trigger(o): Trigger

- Trigger constructor

  #### Parameters

  - ##### o: TriggerCfg

  #### Returns Trigger

  - Defined in saltcorn-data/models/trigger.ts:53

## Properties

### action

action: string

Implementation of AbstractTrigger.action

- Defined in saltcorn-data/models/trigger.ts:38

### `Optional` channel

channel?: string

Implementation of AbstractTrigger.channel

- Defined in saltcorn-data/models/trigger.ts:43

### configuration

configuration: any

Implementation of AbstractTrigger.configuration

- Defined in saltcorn-data/models/trigger.ts:45

### `Optional` description

description?: string

Implementation of AbstractTrigger.description

- Defined in saltcorn-data/models/trigger.ts:39

### `Optional` id

id?: null | number

Implementation of AbstractTrigger.id

- Defined in saltcorn-data/models/trigger.ts:44

### `Optional` min_role

min_role?: number

Implementation of AbstractTrigger.min_role

- Defined in saltcorn-data/models/trigger.ts:46

### `Optional` name

name?: string

Implementation of AbstractTrigger.name

- Defined in saltcorn-data/models/trigger.ts:37

### `Optional` run

run?: ((row, extraArgs?) => Promise<any>)

#### Type declaration

- - (row, extraArgs?): Promise<any>

  - #### Parameters

    - ##### row: Row

    - ##### `Optional` extraArgs: any

    #### Returns Promise<any>

- Defined in saltcorn-data/models/trigger.ts:47

### `Optional` table_id

table_id?: null | number

Implementation of AbstractTrigger.table_id

- Defined in saltcorn-data/models/trigger.ts:40

### `Optional` table_name

table_name?: string

Implementation of AbstractTrigger.table_name

- Defined in saltcorn-data/models/trigger.ts:41

### when_trigger

when_trigger: string

Implementation of AbstractTrigger.when_trigger

- Defined in saltcorn-data/models/trigger.ts:42

## Accessors

### toJson

- get toJson(): any

- Get JSON from Trigger

  #### Returns any

  Implementation of AbstractTrigger.toJson

  - Defined in saltcorn-data/models/trigger.ts:77

### `Static` abbreviated_actions

- get abbreviated_actions(): {
  disableInWorkflow: boolean;
  hasConfig: boolean;
  name: string;
  namespace: any;
  requireRow: boolean;
  }[]

- #### Returns {
  disableInWorkflow: boolean;
  hasConfig: boolean;
  name: string;
  namespace: any;
  requireRow: boolean;
  }[]

  - Defined in saltcorn-data/models/trigger.ts:640

### `Static` when_options

- get when_options(): string[]

- Trigger when options

  #### Returns string[]

  - Defined in saltcorn-data/models/trigger.ts:578

## Methods

### clone

- clone(): Promise<Trigger>

- Clone page

  #### Returns Promise<Trigger>

  Implementation of AbstractTrigger.clone

  - Defined in saltcorn-data/models/trigger.ts:608

### delete

- delete(): Promise<void>

- Delete current trigger

  #### Returns Promise<void>

  Implementation of AbstractTrigger.delete

  - Defined in saltcorn-data/models/trigger.ts:187

### getTags

- getTags(): Promise<AbstractTag[]>

- #### Returns Promise<AbstractTag[]>

  Implementation of AbstractTrigger.getTags

  - Defined in saltcorn-data/models/trigger.ts:635

### runWithoutRow

- runWithoutRow(runargs?): Promise<any>

- Run trigger without row

  #### Parameters

  - ##### runargs: any = {}

  #### Returns Promise<any>

  Implementation of AbstractTrigger.runWithoutRow

  - Defined in saltcorn-data/models/trigger.ts:389

### `Static` action_options

- action_options(__namedParameters): any[]

- #### Parameters

  - ##### __namedParameters: {
    apiNeverTriggers?: boolean;
    builtInLabel?: string;
    builtIns?: string[];
    forWorkflow?: boolean;
    noMultiStep?: boolean;
    notRequireRow?: boolean;
    tableTriggers?: number;
    workflow?: boolean;
    }

    - ##### `Optional` apiNeverTriggers?: boolean

    - ##### `Optional` builtInLabel?: string

    - ##### `Optional` builtIns?: string[]

    - ##### `Optional` forWorkflow?: boolean

    - ##### `Optional` noMultiStep?: boolean

    - ##### `Optional` notRequireRow?: boolean

    - ##### `Optional` tableTriggers?: number

    - ##### `Optional` workflow?: boolean

  #### Returns any[]

  - Defined in saltcorn-data/models/trigger.ts:692

### `Static` create

- create(f): Promise<Trigger>

- Create trigger

  #### Parameters

  - ##### f: TriggerCfg

  #### Returns Promise<Trigger>

  - Defined in saltcorn-data/models/trigger.ts:169

### `Static` emitEvent

- emitEvent(eventType, channel?, userPW?, payload?): void

- Emit an event: run associated triggers

  #### Parameters

  - ##### eventType: string

  - ##### channel: null | string = null

  - ##### `Optional` userPW: object | User = {}

  - ##### `Optional` payload: any

  #### Returns void

  - Defined in saltcorn-data/models/trigger.ts:221

### `Static` find

- find(where?): Trigger[]

- Find triggers in State cache

  #### Parameters

  - ##### `Optional` where: Where

    condition

  #### Returns Trigger[]

  - Defined in saltcorn-data/models/trigger.ts:101

### `Static` findAllWithTableName

- findAllWithTableName(): Promise<Trigger[]>

- Find all triggers

  #### Returns Promise<Trigger[]>

  - Defined in saltcorn-data/models/trigger.ts:124

### `Static` findDB

- findDB(where?, selectopts?): Promise<Trigger[]>

- Find triggers in DB

  #### Parameters

  - ##### `Optional` where: Where

  - ##### `Optional` selectopts: SelectOptions

  #### Returns Promise<Trigger[]>

  - Defined in saltcorn-data/models/trigger.ts:112

### `Static` findOne

- findOne(where): any

- Find one trigger in State cache

  #### Parameters

  - ##### where: Where

  #### Returns any

  - Defined in saltcorn-data/models/trigger.ts:138

### `Static` getAllTableTriggers

- getAllTableTriggers(table): Trigger[]

- get triggers for a table with all when options

  #### Parameters

  - ##### table: AbstractTable

  #### Returns Trigger[]

  - Defined in saltcorn-data/models/trigger.ts:564

### `Static` getTableTriggers

- getTableTriggers(when_trigger, table, user?): Trigger[]

- get triggers

  #### Parameters

  - ##### when_trigger: string

  - ##### table: AbstractTable

  - ##### `Optional` user: Row

  #### Returns Trigger[]

  - Defined in saltcorn-data/models/trigger.ts:529

### `Static` hasTableTriggers

- hasTableTriggers(when_trigger, table): boolean

- get triggers

  #### Parameters

  - ##### when_trigger: string

  - ##### table: AbstractTable

  #### Returns boolean

  - Defined in saltcorn-data/models/trigger.ts:549

### `Static` runTableTriggers

- runTableTriggers(when_trigger, table, row, resultCollector?, user?, extraArgs?): Promise<void>

- Run table triggers

  #### Parameters

  - ##### when_trigger: string

  - ##### table: AbstractTable

  - ##### row: Row

  - ##### `Optional` resultCollector: any

  - ##### `Optional` user: Row

  - ##### `Optional` extraArgs: any

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/trigger.ts:345

### `Static` sendEventToServer

- sendEventToServer(eventType, channel?, user?, payload?): Promise<void>

- #### Parameters

  - ##### eventType: string

  - ##### channel: null | string = null

  - ##### user: {} = {}

  - ##### `Optional` payload: any

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/trigger.ts:197

### `Static` setRunFunctions

- setRunFunctions(triggers, table, user?): void

- #### Parameters

  - ##### triggers: Trigger[]

  - ##### table: AbstractTable

  - ##### `Optional` user: Row

  #### Returns void

  - Defined in saltcorn-data/models/trigger.ts:491

### `Static` state_refresh

- state_refresh(): Promise<void>

- #### Returns Promise<void>

  - Defined in saltcorn-data/models/trigger.ts:145

### `Static` trigger_actions

- trigger_actions(__namedParameters): string[]

- #### Parameters

  - ##### __namedParameters: {
    apiNeverTriggers?: boolean;
    noWorkflows?: boolean;
    tableTriggers?: number;
    }

    - ##### `Optional` apiNeverTriggers?: boolean

    - ##### `Optional` noWorkflows?: boolean

    - ##### `Optional` tableTriggers?: number

  #### Returns string[]

  - Defined in saltcorn-data/models/trigger.ts:657

### `Static` update

- update(id, row): Promise<void>

- Update trigger

  #### Parameters

  - ##### id: number

  - ##### row: Row

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/trigger.ts:155

Generated using TypeDoc