YouTrack Standalone 2017.1 Help

Update Fix Build

This workflow automates several use cases for the Fixed in build field.

File Namejetbrains-youtrack-updateFixBuild
Auto-attachedyes
RulesClear Fixed in build on issue unresolve (stateless)
Copy Fixed in build from duplicated issue (stateless)
Copy Fixed in build to duplicate issues when it is set (stateless)

Use Case

When an issue is re-opened, any value in the Fixed in build field is removed.

Rules

This workflow includes three rules.

Clear Fixed in build on issue unresolve

When an issue is updated, this rule checks that issue is reported (not a draft) and the state is set to an unresolved value (for example, Open, In Progress, or Reopened) and that the previous state was set to a resolved value (for example, Fixed, Duplicate, or Incomplete). If true, the value is removed from the Fixed in build field.

rule Clear Fixed in build on issue unresolve when issue.isReported() && !(issue.State.isResolved) && issue.State.oldValue != null && issue.State.oldValue.isResolved { if (issue.Fixed in build != null) { issue.Fixed in build = null; } }

Copy Fixed in build from duplicated issue

The next rule checks an issue when the state is set to Duplicate. If any duplicated issues have already been resolved and have a value in the Fixed in build field, the Fixed in build field for the duplicated issue is set to the value from the same field in all issues it duplicates.

When an issue is updated, the rule checks if the state is set to Duplicate and the list of linked issues with duplicates links is not empty.
If true, then for each issue in the duplicates list, the rule checks that the duplicated issue and the duplicate (current issue) belong to the same project, and the Fixed in build field of the duplicated issue is not empty.
If true, the value from the Fixed in build field for each duplicated issue is set to the value for the current issue.

rule Copy Fixed in build from duplicated issue when State.becomes({Duplicate}) && duplicates.isNotEmpty { for each duplicatedIssue in duplicates { if (duplicatedIssue.project == project && duplicatedIssue.Fixed in build != null) { Fixed in build = duplicatedIssue.Fixed in build; break; } } }

Copy Fixed in build to duplicate issues when it is set

The last rule checks when an issue update contains a value for the Fixed in build field. If true, then for each issue in the list of linked issues with is duplicated by links, this rule checks that both duplicate and duplicated (current) issues belong to the same project. If true then the Fixed in build value that is set for the current issue is applied to all duplicate issues.

rule Copy Fixed in build to duplicate issues when it is set when Fixed in build.changed && Fixed in build != null { var duplicatedBy = is duplicated by; for each duplicate in duplicatedBy { if (duplicate.project == project) { duplicate.Fixed in build = Fixed in build; } } }
Last modified: 18 April 2017