YouTrack Standalone 2017.2 Help

Mandatory Fields

In some situations, you may want to make the input for a specific field mandatory. Mandatory fields can help you when a particular field is critical for generating a report or is used for issue lifecycle management.

To make a field mandatory, you need to use a workflow. The default workflow Mandatory Field sets the Due Date field as a mandatory field. You can modify this workflow to make another field mandatory, or create a new workflow.

Prerequisites

Before you get started, check the following prerequisites:

  • The field you want to make mandatory is added to your project. The field should have the Can be empty setting enabled.
    For more information, see Attach Custom Fields to Projects.

  • You have downloaded and installed the YouTrack Workflow Editor.
    For more information, see Install the Workflow Editor

To create a workflow:

  1. Open the YouTrack Workflow Editor.

  2. From the Workflow menu, select Create Workflow.

  3. Enter a name for the workflow.

  4. From the Workflow menu, select Create Stateless Rule.

  5. Define the workflow rule. The following example shows you how to set the Subsystem as a required field.
    rule Required Subsystem when becomesReported() { Subsystem.required("Select a Subsystem"); }

    Be sure to use the becomesReported method instead of IsReported. This method ensures that mandatory fields are not checked until the user clicks the Create Issue button and lets you specify more than one mandatory field.

  6. From the Workflow menu, select Upload Workflows to Server.

    — The new workflow is uploaded to your YouTrack instance.

The next step is to attach the workflow to your project in YouTrack. This procedure can be done in two ways based on the permissions that are granted to your user account.

To attach the workflow from the Administration menu:

  1. Select Workflows from the Project-related Settings area of the Administration menu.

  2. Select the new workflow in the list.

    mandatorySubsystemWorkflow thumbnail

  3. Click the + sign in the Projects section of the sidebar and select a project.

To attach the workflow from the Project page:

  1. Click the Projects link.

  2. Select the project to which you want to attach the workflow.

  3. Click the Edit project link.

  4. Select the Workflow tab.

    mandatorySubsystemProject thumbnail

  5. Click the Attach workflows button and select the new workflow from the drop-down list.

The field specified in the workflow is mandatory for new issues in the project. If a user attempts to create an issue that does not specify a value for the required field, a warning is displayed. The required field is highlighted on the form.

subsystemRequiredError thumbnail

Last modified: 7 March 2019