YouTrack Standalone 2021.2 Help

Untag on Reopen

This workflow automatically removes a specific tag from an issue when the state is set from a resolved state to an unresolved state.

Name@jetbrains/youtrack-workflow-untag-on-reopen
Auto-attachedno
ModulesDefine transitions for "State" field with predefined time constraints (on-change rule)

Use Case

This workflow helps you manage tags that indicate an issue has been fixed. You can customise this workflow to automatically remove or update inappropriate tags based on a change in the issue state.

Modules

When the state of an issue is set to an unresolved state, this rule removes the confirmed tag from the issue.

Define transitions for "State" field with predefined time constraints

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Remove tag when issue changes to an unresolved state', guard: (ctx) => { const issue = ctx.issue; return issue.fields.isChanged(ctx.State) && issue.fields.State && !issue.fields.State.isResolved; }, action: (ctx) => { const TARGET_TAG_NAME = 'confirmed'; const issue = ctx.issue; const oldValue = issue.fields.oldValue(ctx.State); if (oldValue && oldValue.isResolved) { issue.removeTag(TARGET_TAG_NAME); const wasSuccessfullyRemoved = !!issue.tags.removed.find(function(tag) { return tag.name === TARGET_TAG_NAME; }); if (wasSuccessfullyRemoved) { workflow.message(workflow.i18n('Tag "{0}" is removed', TARGET_TAG_NAME)); } } }, requirements: { State: { type: entities.State.fieldType } } });

Last modified: 08 March 2021