Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
'''''[[This page is incomplete, incorrect, in the midst of translation, and under development.]]''''' | '''''[[This page is incomplete, incorrect, in the midst of translation, and under development.]]''''' | ||
A Trigger is a script that | A Trigger is a script that defines the processing of an entry based on the Event that took place. Trigger scripts are written in [https://developer.mozilla.org/en-US/docs/web/JavaScript JavaScript]. When a trigger script is executed, it may change an existing entry, create a new entry, execute an http request, create a file, perform data validation, etc. | ||
=== Terminology === | |||
So, we define the following terms: | |||
:; Event type | |||
:: One of the following: | |||
::* Creating an entry | |||
::* Updating an entry | |||
::* Deleting an entry | |||
::* Opening an Entry Edit card | |||
::* Adding an entry to Favorites | |||
::* Removing an entry from Favorites | |||
:; Event | |||
:: One of a predefined set of moments (Event type & Phase) during entry processing during which the user can intervene via a trigger script. See the table of events below. | |||
:; Trigger | |||
:: A script that may be defined to run when an event occurs for an entry | |||
== Creating a trigger == | == Creating a trigger == | ||
Each library can have a number of triggers — up to one for each | Each library can have a number of triggers — up to one for each Event. To see the list of triggers, open the library, open the menu, and then select ''Triggers''. | ||
To create a trigger, open the library's list of triggers and click <big>'''+'''</big>. You must then identify the Event and write a trigger script that performs the necessary actions. | |||
== | == Mode of script execution == | ||
The phase | The phase in which the trigger is activated defines its mode of execution — synchronous or asynchronous. | ||
; Synchronous script execution | ; Synchronous script execution mode | ||
: implies the application suspends user interaction and executes the script. It is not recommended to perform time-consuming operations in this case. | : implies the application suspends user interaction and then executes the script. It is not recommended to perform time-consuming operations in this case. | ||
; Asynchronous script execution | ; Asynchronous script execution mode | ||
: results in the script running in the background; user interaction is not suspended. Usually, asynchronous scripts are used in the last phases of the action. | : results in the script running in the background; user interaction is not suspended. Usually, asynchronous scripts are used in the last phases of the action. | ||
Line 51: | Line 61: | ||
|+ THE DEFINED ACTION TYPES | |+ THE DEFINED ACTION TYPES | ||
|- | |- | ||
! Action type !! Phase !! Execution | ! Action type !! Phase !! Execution mode | ||
|- | |- | ||
| rowspan="3" | '''Creating an entry''' | | rowspan="3" | '''Creating an entry''' |