YouTrack Standalone 2018.3 Help

Comments

This workflow locks an issue so that comments cannot be added after the issue is resolved.

Name

@jetbrains/youtrack-workflow-comments

Auto-attached

no

Modules

Disable comments for verified issues (on-change rule)

Use Case

This workflow was originally taken from a submitted request JT-7326.

The user who submitted this issue wanted a way to lock an issue so that comments cannot be added after the issue has been resolved.

Modules

When an issue is updated, this rule verifies that the issue is already in a state that is Verified and is not set to this state as a result of the update. This prevents the user from setting the state to Verified and adding a comment in the Apply Command window. If this condition is true, the rule verifies that the update does not include a comment.

  • If the update does not include a comment, the issue is updated.

  • If the update includes a comment, a warning is displayed. The comment is not added to the issue.

Disable comments for verified 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('Disable comments for verified issues'), guard: function(ctx) { var issue = ctx.issue; return issue.fields.State.name === ctx.State.Verified.name && !issue.fields.becomes(ctx.State, ctx.State.Verified); }, action: function(ctx) { workflow.check(ctx.issue.comments.added.isEmpty(), workflow.i18n('Commenting for fixed and verified issues is disabled.')); }, requirements: { State: { type: entities.State.fieldType, Verified: {} } } });
Last modified: 7 March 2019