Requirements
Workflow rules and app HTTP handlers can declare a requirements object that identifies the custom fields, field values, and system-wide entities that their code expects to find. For a component that is used in a project, YouTrack validates these dependencies against that project. At runtime, YouTrack exposes resolved fields and entities as aliases in the component context.
This mechanism is not available to widgets, utility modules, or custom MCP tools. It is also separate from required app settings declared in settings.json.
Supported Components
Component | Support | Details |
|---|---|---|
Supported | Declare | |
Supported | Declare | |
Custom MCP tool | Not supported | The object assigned to |
Utility module | Not supported | A utility module is imported by another backend component and uses values passed to it by the caller. |
Widget | Not supported | Widget code runs in the browser and accesses YouTrack through the Host API. |
Requirement Categories
Category | Purpose | Examples |
|---|---|---|
Project-wide | Identifies custom fields that must be attached to the project associated with the component, including required field values and cardinality. | Priority field with a Major value, or a multi-value Assignee field. |
System-wide | Identifies entities that must exist in YouTrack independently of a specific project. | Users, groups, projects, issues, tags, saved searches, and issue link types. |
Validation
For a component that is used in a project, YouTrack validates its requirements against that project. If a required field, value, or entity cannot be resolved, YouTrack reports a problem for the component and does not make it available in that project until the problem is fixed.
A global HTTP handler does not have a project context. It can use system-wide requirements to expose entity aliases, but project-wide requirements can provide field aliases only when the handler invocation has a corresponding project context.
Context Aliases
Every entry in a requirements object has an alias. By default, the alias is also used as the name of the required field, value, or entity. Set the name property when the actual name is different.
A system-wide entity is available as
ctx.<alias>.A custom field is available as
ctx.<field-alias>when the context contains a project.When the context contains an issue, a required field value is available as
ctx.<field-alias>.<value-alias>, and the issue field value can also be accessed throughctx.issue.fields.<field-alias>or the actual field name.
Examples
Workflow Rule Example
The following on-change rule requires the Priority and Assignee fields, the Major priority value, and a user with the qa.lead login. The rule uses aliases from the requirements to update an issue.
HTTP Handler Example
The following issue-scoped handler declares a project field and a system-wide user requirement. Because an issue-scoped invocation has both issue and project context, the handler can use the field and value aliases as well as the user alias.
Requirement Properties
Property | Required | Description |
|---|---|---|
| Yes | The field type or entity constructor used to resolve and validate the requirement. |
| No | The actual name of the field, field value, or named entity. When omitted, YouTrack uses the requirement alias as the name. Users, issues, and issue link types use their type-specific identifying properties instead. |
| No | For a custom field requirement, set to |
Custom Field Types
Custom field type |
|
|---|---|
Build |
|
Enum |
|
Group |
|
Owned field |
|
State |
|
User |
|
Version |
|
Date |
|
Date and time |
|
Float |
|
Integer |
|
String |
|
Text |
|
Period |
|
System-wide Entity Types
Entity |
| Identifying property |
|---|---|---|
User |
|
|
User group |
|
|
Project |
|
|
Issue |
|
|
Tag |
|
|
Saved search |
|
|
Issue link type |
|
|
Project teams are represented as user groups. To require a project team, use entities.UserGroup and set name to the project team name.
Custom Field Value Aliases
For an enum, state, owned, version, build, user, or group field requirement, each additional property represents a required value from the field's value set. The property key is the value alias. Add name when the actual value name is different from the alias.
This example exposes the field as ctx.P, the Major value as ctx.P.M, and the Normal value as ctx.P.Normal.