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

P4 Server Administration Documentation | 2025.2

# Server extension session variables

This section assumes you have read the Server extension callbacks page.

A server extension can get the data about the current command context from the server. The server extension is responsible for interpreting and using these appropriately.

The `maxError…​` variables refer to circumstances that prevented the server from completing a command. For example, an operating system resource issue. Note that client-side errors are not always visible to the server and might not be included in the `maxError` count.

The `terminated` variable indicates whether the command exited early and why.

Argument | Description | Available for type
--- | --- | ---
`%action%` | Either null or a string reflecting an action taken to a changelist or job. For example,"`pending change 123 added`" or "`submitted change 124 deleted`" are possible `%action%` values on `change` forms, and "`job000123 created`" or "`job000123 edited`" are possible `%action%` values for `job` forms. | `form-commit`
`%archiveList%` | Filename containing files to be pulled. | `pull-archive`
`%argc%` | Command argument count. | all except archive
`%args%` | Command argument string. | all except archive
`%argsQuoted%` | Command argument string that contains the command arguments as a percent-encoded comma-separated list. | all except archive
`%changelist%`, `%change%` | The number of the changelist being submitted. The abbreviated form `%change%` is equivalent to `%changelist%`. A `change-submit` event is passed the pending changelist number; a `change-commit` event receives the committed changelist number. A `shelve-commit` or `shelve-delete` event receives the changelist number of the shelf. |
    change-submit
    push-submit
    change-content
    push-content
    change-commit
    push-commit
    fix-add
    fix-delete
    form-commit
    shelve-commit
    shelve-delete
`%changeroot%` | The root path of files submitted. |
    change-commit
    push-commit
`%client%` | Calling user’s client workspace name. | all
`%clientcwd%` | Client’s current working directory. | all except archive
`%clienthost%` | Hostname of the user’s workstation (even if connected through a proxy, broker, replica, or an edge server.) | all
`%clientip%` | The IP address of the user’s workstation (even if connected through a proxy, broker, replica, or an edge server.) | all
`%clientprog%` | The name of the user’s client application. For example, P4V, P4Win | all
`%clientversion%` | The version of the user’s client application. | all
`%command%` | Command name. | all except archive
`%commandIdent%` | The unique identifier of a command. | all
`%depotName%` | The graph depot in which the repo resides. |
    graph-push-start
    graph-push-reference
    graph-push-reference-complete
    graph-push-complete
`%email%` | The user's email address. |
    auth-pre-2fa
    auth-init-2fa
    auth-check-2fa
`%file%` | Path of archive file based on depot’s `Map` field. If the `Map` field is relative to `P4ROOT`, the `%file%` is a server-side path relative to `P4ROOT`. If the `Map` field is an absolute path, the `%file%` is an absolute server-side path. | `archive`
`%firstPushedChange%` | First new changelist number. | `command`
`%formfile%` | Path to temporary form specification file. To modify the form from an `in` or `out` event, overwrite this file. The file is read-only for events of type `save` and `delete`. |
    form-commit
    form-save
    form-in
    form-out
    form-delete
`%formname%` | Name of form (for instance, a branch name or a changelist number). |
    form-commit,
    form-save
    form-in
    form-out
    form-delete
`%formtype%` | Type of form (such as `branch`, `change`, and so on). |
    form-commit,
    form-save
    form-in
    form-out
    form-delete
`%fullname%` | The user's fullname. |
    auth-pre-2fa
    auth-init-2fa
    auth-check-2fa
`%groups%` | List of groups to which the user belongs, space-separated. | all except archive
`%host%` | The IP address of the host of the user. |
    auth-pre-2fa
    auth-init-2fa
    auth-check-2fa
`%intermediateService%` | A broker or proxy is present. | all except archive
`%jobs%` | A string of job numbers, expanded to one argument for each job number specified on a `p4 fix` command or for each job number added to (or removed from) the `Jobs` field in a `p4 submit`, or `p4 change` form. |
    fix-add,
    fix-delete
`%lastPushedChange%` | Last new changelist number. | `command`
`%maxErrorSeverity%` | One of `empty`, `error`, or `warning`. | all except archive
`%maxErrorText%` | Error number and text. | all except archive
`%maxLockTime%` | Limit in milliseconds for data scans. Prevents the server from locking tables for too long. Counting begins when the first table is locked, and includes time spent waiting for any subsequent table locks. (See `p4 help maxopenfiles`.) | all except archive
`%maxMemory%` | Limit in MB of the memory that a command can use. This value is an approximation. (See `p4 help maxopenfiles`.) | all except archive
`%maxOpenFiles%` | Limit of the number of files that can be opened by a single operation. Prevents users from accidentally opening an excessive portion of the repository. (See `p4 help maxopenfiles`.) | all except archive
`%maxResults%` | Limit of the number of rows of result data that can be buffered. Prevents the server from using excessive memory. (See `p4 help maxopenfiles`.) | all except archive
`%method%` | The authentication method from list-methods (might be set to "unknown"). |
`%newValue%` | Graph depot new SHA value. | `graph-push-reference`
`%oldchangelist%` | If a changelist is renumbered on submit, this variable contains the old changelist number. |
    change-commit
    push-commit
`%oldPassword%` | The old value of the password. | auth-set
`%oldValue%` | Graph depot previous SHA value. | `graph-push-reference`
`%op%` | Operation: `read`, `write`, or `delete`. | `archive`
`%password%` | The value of the password. | auth-check
`%peerhost%` | If the command was sent through a proxy, broker, replica, or edge server, the hostname of the proxy, broker, replica, or edge server. (If the command was sent directly, `%peerhost%` matches `%clienthost%`) | all
`%peerip%` | If the command was sent through a proxy, broker, replica, or edge server, the IP address of the proxy, broker, replica, or edge server. (If the command was sent directly, `%peerip%` matches `%clientip%`) | all
`%P4PORT%` | The host port to which the client connects. If the client connects to the server through an intermediary, this will hold the port number of the intermediary. If there’s no intermediary, this will hold the same value as the `%serverAddress%` variable. | auth-check-sso (client-side script only)
`%pusher%` | The user credited with the push. |
    graph-push-start
    graph-push-reference
    graph-push-reference-complete
    graph-push-complete
`%quote%` | A double quote character. | all
`%reference%` | Graph depot reference information. | `graph-push-reference`
`%refFlags%`
`%refType%`
`%repo%` | The repo, which has `.git` as a suffix, but otherwise is identical to `%repoName%`. |
    graph-push-start
    graph-push-reference
    graph-push-reference-complete
    graph-push-complete
`%repoName%` | The name of the repo.
`%rev%` | Revision of archive file. | `archive`
`%scheme%` | The authentication scheme set by init-auth (can be set to "unknown"). | `auth-init-2fa`
`%serverAddress%` | The IP address and port of the P4 Server, passable only in the context of a client-side script specified by `P4LOGINSSO`. | auth-check-sso (client-side script only)
`%serverhost%` | Hostname of the P4 Server. | all
`%serverid%` | The value of the P4 Server’s `server.id`. See `p4 serverid` in the P4 CLI Reference for details. | all
`%serverip%` | The IP address of the server. | all
`%serverport%` | The transport, IP address and port of the P4 Server, in the format `prefix:ip_address:port`. prefix can be one of `ssl`, `tcp6`, or `ssl6`. This means that the command `p4 -p %serverport%` can be used to connect to the server no matter which type of connection the server uses. | all
`%serverroot%` | The `P4ROOT` directory of the P4 Server. | all
`%serverservices%` | A string specifying the role of the server. One of the following: `standard` `replica` `broker` `proxy` `commit-server` `edge-server` `forwarding-replica` `build-server` `P4AUTH` `P4CHANGE` | all except archive
`%serverVersion%` | Version string for the server that terminated if the command exited early. Reason for termination is given in `%termType%`. | all except archive
`%specdef%` | Expanded to the spec string of the form in question. | `form`
%standbyserverid% | Expands to the serverID of the standby before failover (or failback). | failed-over, failed-back
%standbyserverport% | Expands to the P4PORT of the standby before failover (or failback). | failed-over, failed-back
`%submitserverid%` | If this is not a multi-server installation, `%submitserverid%` is always empty. In a multi-server installation, for any change event: if the submit was run on the commit server, `%submitserverid%` equals `%serverid%`. if the submit was run on the edge server, `%submitserverid%` does not equal `%serverid%`. In this case, `%submitserverid%` holds the edge server’s server id. If there is a forwarding replica between the commit server and the edge server, then `%submitserverid%` actually holds the forwarding replica’s server id. See `p4 serverid` in the P4 CLI Reference. |
    change-submit
    change-content
    change-commit
Not available for `push-`* events.
`%targetport%` | The serverport of the target server being monitored. Corresponds to the P4TARGET or the `-t target` value that the p4 heartbeat command uses. | `heartbeat-missing` `heartbeat-resumed` `heartbeat-dead`
`%terminated%` | The value of `0` indicates that the command completed. A value of `1` indicates that the command did not complete. |
`%termType%` | The reason for early termination. This might be one of the following: `'p4 monitor terminate'` `client disconnect` `maxScanRows` `maxLockTime` `maxResults` See also `%serverVersion%`. | all except archive
`%token%` | The stashed token from the last init-auth (can be empty). | `auth-init-2fa`
`%triggerdir%` | Pull.trigger.dir used for tmp files. | `edge-content`
`%triggerMeta_depotFile%` | Third field in server extension definition. For a change-submit event, it is the path for which the server extension is expected to match. For a form-out event, it might be the form type to which the server extension is expected to apply. | all except archive
`%triggerMeta_name%` | Server extension name: first field from server extension definition. | all except archive
`%triggerMeta_trigger%` | Server extension type: second field in server extension definition. | all except archive
`%user%` | P4 Server username of the calling user. | all

Your search for returned results