Triggers
Triggers
Helix Core Server supports triggers, which are user-written programs or scripts that are called when certain operations are performed. Examples of operations that might fire a trigger are changelist submits, changes to forms, and attempts by users to log in or change passwords.
If
the script returns a value of 0
, the operation continues. If
the script returns any other value, the operation fails.
Triggers allow you to extend or customize functionality. Consider the following common uses:
- To validate changelist contents beyond the mechanisms afforded by the
protections table. For example, you can use a pre-submit trigger to
ensure that whenever
file1
is submitted in a changelist,file2
is also submitted. - To perform some action before or after the execution of a particular command.
- To validate forms, or to provide customized versions of
forms. For example, you can use form triggers to generate a customized
default workspace view when users run the
p4 client
command, or to ensure that users always enter a meaningful workspace description. -
To configure Helix Core Server to work with external authentication mechanisms, such as LDAP or Active Directory.
You might prefer to enable LDAP authentication by using an LDAP specification. For more information, see Authentication options.
- To retrieve content from data sources archived outside of the repository.
Be aware that the client's settings might require adjustment. For example, to see the server's output, you might need to enable logging on the P4V client. See the Perforce Knowledge Base article, Debugging Triggers.
If the API level is 79 or greater, canonical filetypes are now displayed by default for all commands that display filetypes. If the API level is 78 or lower, filetype aliases are displayed instead. If your script depends on the display of filetype aliases, you will need either to change the API level or to change your script.
See also Triggers and commit-edge in Managing commit-edge installations.