Requirements
Workflow requirements let you reference custom fields and other YouTrack entities that must be available for a workflow rule to work. Before YouTrack runs the rule, it checks each declaration and makes the matching entity available in the workflow context.
How Requirements Work
Role | What YouTrack checks | What the rule can do |
|---|---|---|
Dependencies | Checks that each required custom field, field value, user, user group, project, issue, tag, saved search, or issue link type is available to the rule. | YouTrack reports missing requirements on the workflow administration pages and does not run the rule until all requirements are available. |
References | Makes each matching entity available under its requirement alias in the | Use aliases such as |
Requirement Categories
Project-Wide Requirements
Use project-wide requirements to list custom fields that must be attached to every project where the workflow is attached and the rule is active. You can also require specific field values that the rule reads, assigns, or compares.
Requirement pattern | Usage | Example declaration |
|---|---|---|
Field type only | Require a user field without specific values. |
|
Field with values | Require an enum field, state field, version field, owned field, or build field with specific values. |
|
Alias with explicit name | Map a stable JavaScript alias to a custom field name that can be longer, localized, or renamed. |
|
Multi-value field | Require a custom field that stores multiple values. |
|
System-Wide Requirements
Use system-wide requirements to list entities that belong to the YouTrack instance rather than a specific project. YouTrack makes each matching entity available in the workflow context.
Entity | API type | Identifier property | Value in the context |
|---|---|---|---|
|
| The required user. | |
|
| The required user group. | |
|
| The required project. | |
|
| The required issue. | |
|
| The required tag. | |
|
| The required saved search. | |
|
| The required issue link type. |
Field Values, Field Types, and Field Prototypes
These expressions refer to different parts of a custom field and are not interchangeable:
Expression | Represents | Typical use |
|---|---|---|
| The value stored in the Assignee field for the current issue. | Read or update the issue's field value. |
| The type of a custom field that stores users. | Require a project-wide custom field in |
| The custom field prototype that matches the | Pass the field itself to API methods or call methods defined on its project-field type. |
| The User entity type. | Require a specific system-wide user, for example by |
You can read the value of an attached field through ctx.issue.fields without adding the field to requirements. Add the field when YouTrack must check that it exists, when the rule references field values by alias, or when the field prototype must be available through ctx.
In this example, ctx.issue.fields.PeriodField is the value stored in the issue, while ctx.PeriodField is the PeriodProjectCustomField prototype:
Requirement Properties and Examples
Common Requirement Patterns
All requirement declarations follow the same structure for project-wide fields, field values, and system-wide entities. The type property identifies the field or entity type. Additional properties identify the specific field, value, or entity.
This declaration requires an Assignee field in every project where the workflow is attached and the rule is active.
This declaration requires a Priority field and two values in that field. The values are available as ctx.Priority.Major and ctx.Priority.Normal.
This declaration requires a user with the specified login and makes the user available as ctx.QALead.
This declaration requires an issue link type with the specified outward and inward names.
Requirement Properties
Each entry in the requirements object has an alias and a set of properties. The type property is required. The available properties depend on the entity type.
Property | Applies to | Description |
|---|---|---|
| Every requirement | The field type or system entity type. This property is required. |
| Fields, field values, groups, projects, tags, and saved searches | The name of the field, value, or entity in YouTrack. If omitted, YouTrack uses the alias. |
| User requirements | The login for a specific user. Used instead of the |
| Issue requirements | The ID of a specific issue, for example |
| Project custom field requirements | A Boolean property. When |
| Issue link type requirements | The outward name of the issue link type. |
| Issue link type requirements | The inward name of the issue link type. |
Complete Workflow Rule Example
This on-change rule combines project-wide and system-wide requirements. When the issue state changes to a value other than Fixed, the rule sets the priority to Critical and displays a message that names the release owner.