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

P4 CLI Documentation | 2025.2

# p4 jobspec

Edit the jobs template to change, add, or remove spec fields for job forms.

## Syntax

    p4 [g-opts] jobspec
    p4 [g-opts] jobspec [-i]
    p4 [g-opts] jobspec -o

Syntax and naming conventions

## Description

The `p4 jobspec` command presents the P4 Server administrator with a form in which job fields can be edited, created, deleted, and refined.

## Form fields

Field Name | Description
--- | ---
`Fields:` | A list of field definitions for your site’s jobs, one field per line. Each line is of the form code name datatype length fieldtype. When adding a new field in 2019.2 or later, the administrator can enter its code by using the optional placeholder value NNN. If the administrator choses this option, the server will assign an appropriate value. Upon saving the jobspec, the next available code value in the 101-119 range will be automatically generated and saved. The values 101 through 105 are reserved for P4, so the effective range is currently 106-199. If the number of fields exhausts the range, new codes are assigned unique values greater than or equal to 10000. Alternatively, the administrator can specify a numeric value. When the administrator saves the spec, a message might indicate that the specified value is not available. code: a unique integer that identifies the field internally to P4 Server. name: the name of the field. This can be changed at any time, while the code should not change once jobs have been created. Field names must not contain spaces. datatype: the datatype of the field. Possible values are: word: a single arbitrary word (a string with no spaces) date: a date/time field select: one of a fixed set of words line: one line of text text: a block of text, starting on the line underneath the fieldname. bulk: like `text`, but not indexed for searching with `p4 jobs` -e. length: recommended length for display boxes in GUI clients accessing this field. Use a value of `0` to let a P4 Server application choose its own value. fieldtype: does the field have a default value? Is it required? Is it read-only? Possible values are: optional: field can take any value or be erased. default: the default value can be changed or erased. required: the default value can be changed but the user must enter a value. once: read-only; the field value is set once to a default value and is never changed. always: read-only; the field value is set to a new default when the job is edited. This is useful only with the `$now` and `$user` variables; it allows you to change the date a job was modified and the name of the modifying user.
`Values:` | Contains a lists of fields and valid values for `select` fields. Enter one line for each field of datatype `select`. Each line must contain the fieldname, a space, and the list of acceptable values separated by slashes. For example: `JobType bug/request/problem`.
`Presets:` | Contains a list of fields and their default values for each field that has a fieldtype of `default`, `required`, `once`, or `always`. Each line must contain the field name and the default value, separated by a space. For example: `JobType bug` Any one-line string can be used, or one of three built-in variables: $user: the user who created the job $now: the current date $blank: the phrase <enter description here> When users enter jobs, any fields in your jobspec with a preset of `$blank` must be filled in by the user before the job is added to the system. See Usage notes for special considerations for field 102.
`Comments:` | Textual comments that appear at the top of each `p4 job` form. Each line must begin with the comment character `#`. See Usage notes for special considerations for these comments if your users need to enter jobs through P4V, the P4 Visual Client (P4V).

## Options

Option | Description
--- | ---
`-i` | Read the jobspec form from standard input.
`-o` | Write the jobspec form to standard output.
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | admin, or `list` to use the `-o` option

- Do not attempt to change, rename, or redefine fields 101 through 105. These fields are used by P4 Server and should not be deleted or changed. Only use `p4 jobspec` to add new fields to your jobs.

  Field 101 is required by P4 Server and cannot be renamed or deleted.

  Fields 102 through 105 are reserved for use by P4 Server applications. Although it is possible to rename or delete these fields, it is highly undesirable to do so. P4 Server applications might continue to set the value of field 102 (the `Status` field) to `closed` (or some other value defined in the `Presets:` for field 102) upon changelist submission, even if the administrator has redefined field 102 to for use as a field that does not contain `closed` as a permissible value, leading to unpredictable and confusing results.

- The information in the `Comments` fields is the only information available to your users to tell them how to fill in the job form, and is also used by P4V, the P4 Visual Client (P4V), to display ToolTips.

- The `Presets:` entry for the job status field (field 102) has a special syntax for providing a default fix status for `p4 fix`, `p4 change` -s, and `p4 submit` -s.

  By default, a job’s status is set to closed after you use `p4 fix`, `p4 change`, or `p4 submit`. To change the default fix status from `closed` to some other `fixStatus` (assuming that you have defined the `fixStatus` as a valid `select` setting in the `Values` field), use the special syntax of ``jobStatus`,fix/`fixStatus`` in the `Presets` field for field 102 (job status). To change the behavior of `p4 fix`, `p4 change`, and `p4 submit` to leave job status unchanged, use the special `fixStatus` of `same`.

- See the example of a customized jobspec in the "Customizing Perforce: Job Specifications" chapter of the P4 Server Administration Documentation.

## Related commands

To create, edit, or view a job | `p4 job`
To attach a job to a changelist | `p4 fix`
To list jobs | `p4 jobs`
To list jobs attached to specific changelists or changelists attached to specific jobs | `p4 fixes`

Your search for returned results