Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Stamp|2016-11-11|4.0.0|1.0.6}} | {{Stamp|2016-11-11|4.0.0|1.0.6}} | ||
A Trigger is a script that defines the processing of an entry | A Trigger is a script that defines the processing of an entry whenever a particular kind of event takes place. Trigger scripts are written in [https://developer.mozilla.org/en-US/docs/web/JavaScript JavaScript]. When a trigger script is executed, it may perform actions like changing an existing entry, creating a new entry, executing an HTTP request, creating a file, performing data validation, etc. | ||
=== Terminology === | === Terminology === | ||
Line 15: | Line 15: | ||
:; Phase of an Event | :; Phase of an Event | ||
:: One of a predefined set of moments during entry processing during which the user can intervene via a trigger script. See [[#Events|the table of events and phases below]].<br/> The Event type and the Phase determine the trigger script to be run. | :: One of a predefined set of moments during entry processing for each Event type during which the user can intervene via a trigger script. See [[#Events|the table of events and phases below]].<br/> The Event type and the Phase determine the trigger script(s) to be run. | ||
:; Trigger or Trigger Script | :; Trigger or Trigger Script | ||
Line 24: | Line 24: | ||
; Synchronous script execution mode | ; Synchronous script execution mode | ||
: Memento suspends user interaction and then executes the script. In the case of '''Before...''' phases, | : Memento suspends user interaction and then executes the script. In the case of '''Before...''' phases, there is an impending operation that will take place unless the script forestalls it by calling ''cancel()''.<br/>Time-consuming operations are not recommended in this mode. | ||
; Asynchronous script execution mode | ; Asynchronous script execution mode | ||
: The script runs in the background; user interaction is '''not''' suspended. Usually, asynchronous scripts are used in the last phases of the action. | : The script runs in the background; user interaction is '''not''' suspended. Usually, asynchronous scripts are used in the last phases of the action, after any save or other operation is initiated. | ||
== Creating a trigger == | == Creating a trigger == | ||
Each library can have a number of triggers | Each library can have a number of triggers; multiple triggers may exist for each Event type and Phase. To see the list of triggers, open the library, open the menu, and then select ''Triggers''. | ||
To create a trigger, press the 3-dot icon in the upper-right corner of the screen to open the Action Menu; then press Triggers to open the list of existing triggers; then click <big>'''+'''</big>. You must then identify the Event type & Phase and write a trigger script that performs the necessary actions. | To create a trigger, press the 3-dot icon in the upper-right corner of the screen to open the Action Menu; then press Triggers to open the list of existing triggers; then click <big>'''+'''</big>. You must then identify the Event type & Phase and write a trigger script that performs the necessary actions. | ||
Line 81: | Line 81: | ||
The user must define these permissions manually for each library. | The user must define these permissions manually for each library. | ||
To open | To open a card to set permissions for scripts, open the library triggers list and click the shield icon on the toolbar. Permissions must be set separately on each device. Permissions are not synchronized between devices. | ||
=== Permissions for scripts === | === Permissions for scripts === |