YouTrack Standalone 2021.1 Help

Comments

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

Name@jetbrains/youtrack-workflow-comments
Auto-attachedno
ModulesDisable 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

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Disable comments for verified issues', guard: (ctx) => { const issue = ctx.issue; return issue.fields.is(ctx.State, ctx.State.Verified) && !issue.fields.becomes(ctx.State, ctx.State.Verified); }, action: (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: 08 March 2021