Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.2

# Triggering on forms

To configure P4 Server to run trigger scripts when users edit forms, use form triggers: these are triggers of type `form-save`, `form-in`, `form-out`, `form-delete`, and `form-commit`.

Use form triggers to generate customized field values for users, to validate data provided on forms, to notify other users of attempted changes to form data, and to otherwise interact with process control and management tools.

The `%specdef%` variable is defined for form triggers: it is expanded to the spec string of the form in question. This allows derived APIs to parse forms as part of triggers by loading the spec string as an argument.

If you write a trigger that fires on trigger forms, and the trigger fails in such a way that the `p4 triggers` command no longer works, the only recourse is to remove the `db.triggers` file in the server root directory.

The following table describes the fields of a form trigger definition:

Field | Meaning
--- | ---
`name` | The name of the trigger.
`type` | form-save: Execute a form trigger after the form contents are parsed, but before the contents are stored in the P4 Server database. The trigger cannot modify the form specified in `%formfile%` variable. form-out: Execute form trigger upon generation of form to end user. The trigger can modify the form. form-in: Execute form trigger on edited form before contents are parsed and validated by P4 Server. The trigger can modify the form. form-delete: Execute form trigger after the form contents are parsed, but before the form is deleted from the P4 Server database. The trigger cannot modify the form. form-commit: Execute form trigger after the form has been committed for access to automatically-generated fields such as jobname, dates, etc.
`path` | The name of the type of form, (`branch`, `change`, `client`, `depot`, `group`, `job`, `label`, `protect`, `server`, `spec`, `stream`, `triggers`, `typemap`, or `user`).
`command` | The trigger for P4 Server to run when the type of form specified in the `path` field is processed. Specify the command in a way that allows P4 Server account to locate and run the command. The `command` (typically a call to a script) must be quoted, and can take as arguments any argument that your `command` is capable of parsing, including any applicable P4 Server trigger variables. When your trigger script is stored in the depot, its path must be specified in depot syntax, delimited by percent characters. For example, if your script is stored in the depot as `//depot/scripts/myScript.pl`, the corresponding value for the command field might be `"/usr/bin/perl %//depot/scripts/myScript.pl%"`. See Storing triggers in the depot for more information. For `form-in`, `form-out`, `form-save`, and `form-delete` triggers, the data in the specification becomes part of the P4 Server database if the script succeeds. Otherwise, the database is not updated.

Your search for returned results