Trigger

Triggers

Automate workflows using the trigger system.


Trigger Trigger System Introduction

KeePass features a powerful event-condition-action trigger system. With this system, workflows can be automated. For example, you could define a trigger that automatically uploads your database to a backup server after saving the file locally.

A trigger starts to run when any of the specified events matches. When this happens, the conditions are checked. If all conditions are fulfilled, the actions of the trigger are performed. Actions are performed consecutively; if one action fails, typically the execution of the event is aborted (i.e. all following actions aren't performed).

A trigger must be both enabled and on in order to get executed. The enabled state is set by the user; a disabled trigger has no function. The on state is dependent on the state of the program. By enabling the 'Initially On' option, a trigger is on by default. If you enable the option 'Turn off after executing actions', the trigger will be off after running once. There are actions to turn triggers on and off, i.e. triggers can turn themselves and other triggers on and off, which allows to define a complex state-dependent system of triggers.

Most strings in the trigger system are Spr-compiled, i.e. placeholders (except state-changing ones), environment variables, etc. can be used.

Sensitive Data.
Some trigger events/conditions/actions support fields for potentially sensitive data (for instance the password field of the 'Open database file' action). As triggers are saved in a plain text configuration file, it is generally not recommended to directly enter sensitive data in trigger fields. If a database is open when the trigger runs, the sensitive data can be stored in the database and the trigger field can point to the data using a field reference (which KeePass resolves when evaluating the field). In this way, only the field reference appears in the configuration file and the actual sensitive data is stored in the encrypted database file.

IO Connection Properties.
Most trigger actions having a file path/URL parameter only allow specifying the path/URL and possibly credentials (user name and password) for accessing the file; advanced connection properties (like timeout, user agent, passive mode, etc.) cannot be specified here. If advanced connection properties are required, open the file once (using 'File' → 'Open') with the desired connection properties. This will create an item in the 'Open Recent' file list (which remembers connection properties). When a trigger action is executed, KeePass loads the connection properties from the corresponding item (same path/URL) in the 'Open Recent' file list.


Trigger Events


Trigger Conditions


Trigger Actions


Trigger Examples

See the Trigger Examples page.