YouTrack Standalone 2017.3 Help

Mandatory Field

This workflow forces users to enter a value in a specific issue field. You can customize this workflow to make any issue field mandatory.

Namejetbrains-youtrack-mandatoryField
Auto-attachedno
Modules Require due dates for submitted issues (on-change rule)

Use Case

This workflow requires that every reporter sets a due date for resolving an issue.

To use this workflow, you should either add a Due Date field to your project or create another date-type field and modify the reference to the Due Date field in the default workflow.

This workflow was originally taken from a submitted request (JT-5998).

The user who submitted this issue wanted to make a field required for all new issues so that it could be used as the basis for a report.

Modules

This rule prevents the creation of an issue unless the due date is set. If the Due Date field is empty, a warning is displayed.

First, the rule verifies that the issue has not been reported. This means the warning is displayed when the user is still creating the issue or working with an issue draft. If true, it checks for a value in the Due Date field with the required method.

  • If the Due Date field is empty, a warning is displayed. The required field is highlighted. The user cannot create the issue.
  • If the Due Date is set, the user can create the issue.

Require due dates for submitted issues

var entities = require('@jetbrains/youtrack-scripting-api/entities'); var workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: workflow.i18n('Don\'t allow to submit issue without Due date set'), action: function(ctx) { var issue = ctx.issue; if (issue.becomesReported) { issue.fields.required(ctx.DueDate, workflow.i18n('You must set the Due date!')); } }, requirements: { DueDate: { type: entities.Field.dateType, name: "Due Date" } } });
Last modified: 18 August 2017