Triggers: Difference between revisions

Jump to navigation Jump to search
610 bytes added ,  21 April 2021
m
no edit summary
mNo edit summary
mNo edit summary
Line 103: Line 103:


:; 3. After saving the entry (asynchronous): The script will be called once the save of the entry has been initiated and will continue in parallel with final processing of the new entry.<br/>If you want to do something whenever a new entry is added, but not before the data is saved, this is the place to do it.
:; 3. After saving the entry (asynchronous): The script will be called once the save of the entry has been initiated and will continue in parallel with final processing of the new entry.<br/>If you want to do something whenever a new entry is added, but not before the data is saved, this is the place to do it.
==== Scripting considerations: Creating an entry ====
''Creating'' scripts are different from other trigger scripts in that, since the new entry is being crafted, it is not yet stored within Memento, so it needs to be handled differently.
Use the method ''defaultEntry()'', rather than ''entry()'', to get the DefaultEntry object (the unstored template, if you will, for the eventual Entry object).
Once the default entry is saved, it can be referred to by calling ''entry()'' to get the saved Entry object. So ''Before saving'' scripts use ''defaultEntry()'', and ''After saving'' scripts use ''entry()''.


=== Updating an entry ===
=== Updating an entry ===

Navigation menu