Triggers: Difference between revisions

1,015 bytes added ,  14 November 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 95: Line 95:
:; Network
:; Network
:: grants to the script the right to execute HTTP requests
:: grants to the script the right to execute HTTP requests
-----
<br/>
== Writing a Trigger Script ==
Trigger scripts are JavaScripts. 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.
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.
Note the global functions in the sections below; they generally get you started by providing needed information.
If a script is running in a synchronous phase, then a call to ''cancel()'' may make sense, but the user won't know what happened unless you provide that information, probably via ''message()''.
Certain functions require special permissions; read [[#Security|above]] about that. One such function is ''llibByName()''. Others include the file access functions.
-----
-----
<br/>
<br/>