Actions
Table of contents
- Action Types
- Creating an Action
- Action Visibility
- Arguments
- Available Functions and Objects
- Examples
Actions are special scripts that users can trigger by pressing toolbar buttons in Memento Database. They can be executed from various locations and run in the background. Actions share the same security parameters and available functions as trigger scripts.
Action Types
Actions can be created in four different contexts:
- Library Actions: Execute operations on the entire library
- Entry Actions: Perform tasks on a single entry (appears in Entry View card)
- Entries in List: Display action buttons for each entry row in the list view
- Bulk Actions: Process multiple selected entries simultaneously
Creating an Action
- Navigate to Library > Menu > Scripts
- Click the + button
- Select Actions
- Choose the action context (Library, Entry, Entries in List, or Bulk actions)
Action Visibility
- Library actions appear in the main toolbar
- Entry actions appear in the Entry View card toolbar
- Entries in List actions show as buttons in each entry row
- Bulk actions are available in the menu when multiple entries are selected
On the View tab, you can configure:
- User Access
- Specify which users can see and use the action
- Entry Filters (for Entry View card and Entries in List actions)
- Configure filters similar to entry list filters
- The action button will only be visible for entries matching the filter conditions
Arguments
Arguments allow users to input values when running an action.
Setting Up Arguments
- Open the Action Edit card
- Navigate to the Arguments tab
- Click the + button to add new arguments
Using Arguments in Scripts
Access argument values using the arg()
function:
// Example: Getting a text argument value
let userInput = arg("inputName");
// Example: Getting a numeric argument
let quantity = arg("amount");
The return type of arg()
matches the argument type, similar to the field()
function.
Available Functions and Objects
Library Context
Use lib()
to access the current library
let currentLib = lib();
Entry Context
Use entry()
to access the current entry
let currentEntry = entry();
Bulk Context
Use selectedEntries()
to access selected entries
let entries = selectedEntries();
for (let entry of entries) {
// Process each selected entry
}
Examples
Library Action
// Count total entries in library
let total = lib().entries().length;
message("Total entries: " + total);
Entry Action
// Update entry status
entry().set("status", "Processed");
Entries in List
// Quick status toggle
let status = entry().field("status");
entry().set("status", status === "Active" ? "Inactive" : "Active");
Bulk Action
// Mark multiple entries as reviewed
for (let entry of selectedEntries()) {
entry.set("reviewed", true);
}