# 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 |
| Rules |  [Disable comments for verified issues](#no-comment) (on-change rule)  |

## Use Case

This workflow was originally taken from a submitted request [JT-7326](https://youtrack.jetbrains.com/issue/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.

## Rules

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 dialog. 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

This on-change rule behaves in the following way:

#### Rule Prerequisites

Whenever an issue is created or updated in the project where the rule is active, it checks the issue for the following conditions:

| Conditions | Description |
| --- | --- |
| [Field Matches Specified Criteria](workflow-constructor-conditions.html#field-matches-specified-criteria) | This condition block is configured with the following settings:       * Field: State    * Condition: is    * Value: Verified     This checks to see if the value for the State field is set to Verified.    |
| [Field Matches Specified Criteria](workflow-constructor-conditions.html#field-matches-specified-criteria) | This condition is nested inside a [NOT](workflow-constructor-building-blocks.html#not-building-block) building block. As a result, this conditions is only satisfied when the specified criteria is absent.     The condition block is configured with the following settings:       * Field: State    * Condition: changes from    * Value: Any value    * to: Verified     This condition ensures that the value for the State field is already Verified and is not set to this state as a result of the update that triggers the workflow rule.    |

The conditions are joined with implicit AND operators. This means the workflow will only apply the changes specified in the Actions section if all conditions are satisfied.

#### Rule Actions

If prerequisite conditions are met for the current issue, the workflow automatically applies the following changes:

| Action | Description |
| --- | --- |
| [Check for Additional Conditions](workflow-constructor-actions.html#check-for-additional-conditions) | This action checks to see if a comment is added to the issue in the current transaction. This is done by nesting a [Comment Is Added](workflow-constructor-conditions.html#comment-is-added) condition block inside a [NOT](workflow-constructor-building-blocks.html#not-building-block) building block.     The Error message setting in the action block stores the message that is shown when the user attempts to add a comment to a verified issue. If the additional check fails, this message is displayed as an error in the YouTrack application interface.    |

