Triggers: Difference between revisions

No change in size ,  16 November 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 154: Line 154:
=== Writing a Trigger Script ===
=== Writing a Trigger Script ===
Trigger scripts are JavaScripts. See '''''[[#JavaScript links|links to JavaScript documentation]]''''' below.
Trigger scripts are JavaScripts. See '''''[[#JavaScript links|links to JavaScript documentation]]''''' below.
; No return: As of release 4.0.0 of the mobile edition, the script is executed as a top-level script and not as a called function; therefore, for instance, the ''return'' statement is not appropriate in a trigger script.


; Event & Phase: Make sure to understand the Event & Phase you are scripting. This will dictate a number of things, such as whether data is present already or not, whether ''cancel()'' makes sense or not, whether the user is waiting for script execution or not, and so on.
; Event & Phase: Make sure to understand the Event & Phase you are scripting. This will dictate a number of things, such as whether data is present already or not, whether ''cancel()'' makes sense or not, whether the user is waiting for script execution or not, and so on.
Line 164: Line 162:


; Permissions: Certain functions require special permissions; read '''''[[#Security|above]]''''' about that. One such function is ''libByName()''. Others include the file access and HTTP functions.
; Permissions: Certain functions require special permissions; read '''''[[#Security|above]]''''' about that. One such function is ''libByName()''. Others include the file access and HTTP functions.
; No return: As of release 4.0.0 of the mobile edition, the script is executed as a top-level script and not as a called function; therefore, for instance, the ''return'' statement is not appropriate in a trigger script.
-----
-----
<br/>
<br/>