Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 105: | Line 105: | ||
==== entry() ==== | ==== entry() ==== | ||
: Get the entry | : Get the entry of the Event. For example, if script is triggered by an Update Entry event, this method will return the entry being updated. | ||
: This | : This method is available to all Events and Phases, with the exception of "Creating a file > Opening an Entry Edit card for add"; for this action, use the method entryDefault(). | ||
: Result: | :; Result: Entry object — the current entry | ||
==== entryDefault() ==== | ==== entryDefault() ==== | ||
: Get the Entry object containing the default values for the Entry not yet created. This feature is available for the | : Get the Entry object containing the default field values for the Entry not yet created. This feature is available for the Event ''Creating an entry > Opening an Entry Edit card''. | ||
:Result: The object | :; Result: The DefaultEntry object | ||
==== lib() ==== | ==== lib() ==== | ||
: Get the library | : Get the library of the Event | ||
: Result: | :; Result: Library object — the current library | ||
==== libByName(name) ==== | ==== libByName(name) ==== | ||
: | : Get the named library. Permission to use the library is required. | ||
:Result: | :; Argument: The name of the library to get | ||
:; Result: Library object — the library identified by the argument ''name'' | |||
=== Object ''Library'' === | === Object ''Library'' === | ||
This object provides access to library entries. You can work with the current library — the lib() or any other library database — libByName(). This method provides the ability to update existing entries and create new ones. | This object provides access to library entries. You can work with the current library — the lib() — or any other library database — libByName(). This method provides the ability to update existing entries and create new ones. | ||
==== Methods ==== | ==== Methods ==== | ||
===== entries() ===== | ===== entries() ===== | ||
: Get all the entries of the library | : Get all the entries of the library | ||
:; Result: array | :; Result: array object containing entries, sorted by the time of their creation, from newest to oldest | ||
===== find(query) ===== | ===== find(query) ===== | ||
: Search for entries in the library matching given field values. This search is similar to searching via Memento's user interface. | : Search for entries in the library matching given query, which are field values. This search is similar to searching via Memento's user interface. | ||
:; | :; Argument: query — the search string | ||
:; Result: Array | :; Result: Array object containing matching entries. Entries are sorted by the time of their creation, from newest to oldest. | ||
===== findByKey(name) ===== | ===== findByKey(name) ===== | ||
: Search for all entries by the Entry Name field value. The library must be | : Search for all entries by the Entry Name field value. The library must be set for unique Entry Names. | ||
:; | :; Argument: name — the Entry Name field value | ||
:; Result: | :; Result: Entry object | ||
===== create(values) ===== | ===== create(values) ===== | ||
: Create a new entry in the library | : Create a new entry in the library | ||
:; | :; Argument: [https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object '''Object'''] containing the field values | ||
:; Result: | :; Result: Entry object — the new entry in the library | ||
==== Properties ==== | ==== Properties ==== | ||
; Title : The name of the library | ; Title : The name of the library | ||
----- | |||
=== Object ''Entry'' === | === Object ''Entry'' === | ||
This place is a record library and provides the ability to get and set field values. | This place is a record library and provides the ability to get and set field values. |