# Issue

Represents an issue in YouTrack. The `Issue` entity is the central entry point for workflow rules that read or modify issue data. In an issue-based rule, the issue currently being processed is available as `ctx.issue`.

Use issue properties to access data such as `summary`, `description`, `project`, `reporter`, `comments`, `attachments`, `links`, `tags`, `workItems`, and `vcsChanges`. Custom field values are available through `ctx.issue.fields`.

Issue methods let you inspect changes in the current transaction, validate and update issue data, add comments or attachments, manage tags, check visibility, define issue-based rules, create drafts, and find existing issues. For details about how workflow changes are applied, see [Workflow
Transactions](workflow-transactions.html).

`Issue` extends [BaseEntity](v1-BaseEntity.html).

## Properties

| Name | Type | Description |
| --- | --- | --- |
| attachments |  [Set](v1-Set.html).<[IssueAttachment](v1-IssueAttachment.html)>  | Read-only.  The attachments added to the issue.   |
| becomesRemoved |  Boolean  | Read-only.    When `true`, the entity is removed in the current transaction. Otherwise, `false`. This property can become `true` only in on-change rules when the rule is triggered on the removal of an issue or an article.     In the rule code, the `runOn` rule property must contain the `removal` parameter set to `true`.     Available since 2017.4.37915      ```JAVASCRIPT runOn: {removal: true} ```    |
| becomesReported |  Boolean  | Read-only.    If the issue becomes reported in the current transaction, this property is `true`.      ```JAVASCRIPT if (issue.fields.Subsystem !== null && issue.fields.Assignee === null &&     (((issue.isChanged('Subsystem') \|\| issue.isChanged('project') && issue.isReported) \|\|         issue.becomesReported) {     issue.fields.Assignee = issue.fields.Subsystem.owner } ```    |
| becomesResolved |  Boolean  | Read-only.  If the issue was previously unresolved and is assigned a state that is considered resolved in the current transaction, this property is `true`.   |
| becomesUnresolved |  Boolean  | Read-only.  If the issue was previously resolved and is assigned a state that is considered unresolved in the current transaction, this property is `true`.   |
| ccUsers |  [Set](v1-Set.html).<[User](v1-User.html)>  |    The users added as CCs to the helpdesk ticket. The ticket reporter is excluded automatically.     Up to 10 reporter-type users can be kept in CC; extra reporters are removed automatically.     Available since 2026.1    |
| channel |  [Channel](v1-Channel.html)  | Read-only.  The channel used by the reporter to create the ticket. Possible values are [FeedbackForm](v1-FeedbackForm.html) for online forms or [MailboxChannel](v1-MailboxChannel.html) for email.   |
| comments |  [Set](v1-Set.html).<[IssueComment](v1-IssueComment.html)>  | Read-only.  A list of comments for the issue.   |
| created |  Number  | Read-only.  The date when the issue was created.   |
| customerGroups |  [Set](v1-Set.html).<NestedUserGroup>  | Read-only.  The customer groups this helpdesk ticket is shared with. Members of these groups can view the ticket and add public comments.             Available since 2026.2    |
| description |  String  |  The text that is entered as the issue description.   |
| draftId |  String  | Read-only.  The ID of the issue draft. If the issue is not a draft, this property is `null`.             Available since 2025.3    |
| duplicateRoot |  [Issue](#issue-entity)  | Read-only.    The root issue in a tree of duplicates that are linked to the issue.     For example, if `issueA` duplicates `issueB` and `issueB` duplicates `issueC`, then the value of `issueA.duplicateRoot` is `issueC`.     |
| editedComments |  [Set](v1-Set.html).<[IssueComment](v1-IssueComment.html)>  | Read-only.  The set of comments that are edited in the current transaction.     Comments that are added and removed are not considered to be edited. Instead, these are represented by the `issue.comments.added` and `issue.comments.removed` properties.    |
| editedWorkItems |  [Set](v1-Set.html).<[IssueWorkItem](v1-IssueWorkItem.html)>  | Read-only.  The set of work items that are edited in the current transaction. Work items that are added and removed are not considered to be edited. Instead, these are represented by the `issue.workItems.added` and `issue.workItems.removed` properties.             Available since 2017.4.37824    |
| extensionProperties |  Object  |    The object containing extension properties for this entity and their values. Extension properties are custom properties that might be added to core YouTrack entities by an app.     For details, see [Extension Properties](apps-extension-properties.html).     Available since 2024.3      ```JAVASCRIPT const entities = require('@jetbrains/youtrack-scripting-api/entities');  exports.rule = entities.Issue.action({     command: 'test',     action: function (ctx) {         const printValues = () => {             return 'stringProp:' + ctx.issue.extensionProperties.stringProp + ';'                 + 'integerProp:' + ctx.issue.extensionProperties.integerProp + ';'                 + 'booleanProp:' + ctx.issue.extensionProperties.booleanProp + ';'                 + 'issueProp:' + ctx.issue.extensionProperties.issueProp?.id + ';'                 + 'issuesProp:' + ctx.issue.extensionProperties.issuesProp?.first()?.id + ';'         }         ctx.issue.addComment(printValues());     } }); ```    |
| fields |  [Fields](v1-Fields.html)  |    The custom fields that are used in an issue. This is the collection of issue attributes like `Assignee`, `State`, and `Priority` that are defined in the Custom Fields section of the administrative interface and can be attached to each project independently.     Issue attributes like `reporter`, `numberInProject`, and `project` are accessed directly.      ```JAVASCRIPT if (issue.fields.becomes(ctx.Priority, ctx.Priority.Critical) {   issue.fields.Assignee = issue.project.leader; } ```    |
| ganttCharts |  [Set](v1-Set.html).<[Gantt](v1-Gantt.html)>  | Read-only.  The collection of [Gantt](v1-Gantt.html) charts that this issue has been added to.             Available since 2022.1    |
| id |  String  | Read-only.    The issue ID.      ```JAVASCRIPT user.notify('Issue is overdue', 'Please, look at the issue: ' + issue.id); ```    |
| isNew |  Boolean  | Read-only.  When `true`, the entity is created in the current transaction. Otherwise, `false`.             Available since 2018.2.42351    |
| isReported |  Boolean  | Read-only.    If the issue is already reported or becomes reported in the current transaction, this property is `true`.     To apply changes to an issue draft, use `!issue.isReported`.      ```JAVASCRIPT issue.links['depends on'].forEach(function(dep) {   if (dep.isReported) {     assert(dep.State.resolved, 'The issue has unresolved dependencies and thus cannot be set Fixed!');   } }); ```    |
| isResolved |  Boolean  | Read-only.  If the issue is currently assigned a state that is considered resolved, this property is `true`.   |
| isStarred |  Boolean  | Read-only.  If the current user has added the `Star` tag to watch the issue, this property is `true`.   |
| links |  Object  |    Issue links, for example, `relates to` and `parent for`.     Each link is a [Set](v1-Set.html) of [Issue](#issue-entity) objects.      ```JAVASCRIPT if (issue.links['parent for'].added.isNotEmpty()) {   issue.links['parent for'].added.forEach(function(subtask) {     subtask.fields.Priority = issue.fields.Priority;   }); } ```    |
| mentionedInIssueComments |  [Set](v1-Set.html).<[IssueComment](v1-IssueComment.html)>  | Read-only.  The set of issue comments where this issue is mentioned.   |
| mentionedInIssues |  [Set](v1-Set.html).<[Issue](#issue-entity)>  | Read-only.  The set of issues where this issue is mentioned.   |
| numberInProject |  Number  | Read-only.  The issue number in the project.   |
| permittedGroup |  [UserGroup](v1-UserGroup.html)  |    The user group for which the issue is visible.     If this property is `null`, the issue is visible to the All Users group.     |
| permittedGroups |  [Set](v1-Set.html).<[UserGroup](v1-UserGroup.html)>  |  The groups for which the issue is visible when the visibility is restricted to multiple groups.   |
| permittedUsers |  [Set](v1-Set.html).<[User](v1-User.html)>  |  The list of users for whom the issue is visible.   |
| pinnedComments |  [Set](v1-Set.html).<[IssueComment](v1-IssueComment.html)>  | Read-only.  The set of comments that are pinned in the issue.             Available since 2024.1    |
| project |  [Project](v1-Project.html)  |  The project to which the issue is assigned.   |
| pullRequests |  [Set](v1-Set.html).<[PullRequest](v1-PullRequest.html)>  | Read-only.    The pull request snapshots that are associated with the issue. A state change adds a new snapshot to this set instead of updating an existing object.     In an on-change rule, inspect `issue.pullRequests.added` to detect a new state, and use the [PullRequest](v1-PullRequest.html) properties `state` and `previousState` to identify the transition.     Do not inspect the complete set or call `last()` for this purpose, because the same persisted snapshot can match again on a later, unrelated issue update.      ```JAVASCRIPT const entities = require('@jetbrains/youtrack-scripting-api/entities');  exports.rule = entities.Issue.onChange({   title: 'Set issue state when a pull request is merged',   guard: (ctx) => ctx.issue.pullRequests.added.find((pullRequest) =>     pullRequest.state.name === 'MERGED' &&     pullRequest.previousState &&     pullRequest.previousState.name !== 'MERGED'   ),   action: (ctx) => {     ctx.issue.fields.State = ctx.State.Fixed;   },   requirements: {     State: {       type: entities.State.fieldType,       Fixed: {}     }   } }); ```          Available since 2020.3    |
| reporter |  [User](v1-User.html)  | Read-only.    The user who reported (created) the issue.      ```JAVASCRIPT issue.fields.Assignee = issue.reporter; ```    |
| resolved |  Number  | Read-only.  The date and time when the issue was assigned a state that is considered to be resolved.   |
| summary |  String  |  The text that is entered as the issue summary.   |
| tags |  [Set](v1-Set.html).<[Tag](v1-Tag.html)>  |  The list of tags that are attached to an issue.   |
| unauthenticatedReporter |  Boolean  | Read-only.  When `true`, the ticket was created by a reporter who was not logged in to YouTrack when they submitted the support request.   |
| updated |  Number  | Read-only.  The date when the issue was last updated.   |
| updatedBy |  [User](v1-User.html)  | Read-only.  The user who last updated the issue.   |
| url |  String  | Read-only.    The absolute URL that points to the issue.      ```JAVASCRIPT user.notify('Issue is overdue', 'Please, look at the issue: ' + issue.url); ```    |
| vcsChanges |  [Set](v1-Set.html).<[VcsChange](v1-VcsChange.html)>  | Read-only.  The list of commits that are associated with the issue.             Available since 2018.1.38923    |
| voters |  [Set](v1-Set.html).<[User](v1-User.html)>  | Read-only.  The users who voted for the issue.             Available since 2020.5    |
| votes |  Number  | Read-only.    The number of votes for an issue.     For vote-related methods, see [User.canVoteIssue()](v1-User.html#canVoteIssue), [User.voteIssue()](v1-User.html#voteIssue), [User.canUnvoteIssue()](v1-User.html#canUnvoteIssue), and [User.unvoteIssue()](v1-User.html#unvoteIssue).     |
| watchers |  [Set](v1-Set.html).<[User](v1-User.html)>  | Read-only.  The users who watch the issue.             Available since 2025.3    |
| workItems |  [Set](v1-Set.html).<[IssueWorkItem](v1-IssueWorkItem.html)>  | Read-only.  The set of work items that have been added to the issue.   |

## Constructors

### Issue

```JAVASCRIPT
Issue(reporter, project, summary)
```

Parameters

| Name | Type | Description |
| --- | --- | --- |
| reporter |  [User](v1-User.html), [JsonForIssueConstructor](v1-JsonForIssueConstructor.html)  |  The issue reporter, or an object described by [JsonForIssueConstructor](v1-JsonForIssueConstructor.html).                     |
| project |  [Project](v1-Project.html)  |  The project where the new issue belongs.                     |
| summary |  String  |  The summary of the new issue.                     |

## Methods

### action

```JAVASCRIPT
static action(ruleProperties)
```

Creates a declaration of a rule that a user can apply to one or more issues with a command or menu option. The returned object is normally exported to the `rule` property. Otherwise, YouTrack does not treat it as a rule.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | ruleProperties |  Object  |  An object that defines the rule.                     |

Properties of ruleProperties
: | Name | Type | Description |
: | --- | --- | --- |
: | title |  string  |  The human-readable name of the rule. Displayed in the administrative UI in YouTrack.                     |
: | command |  string  |  The custom command that triggers the action.                     |
: | userInput |  Object  |    An object that defines the information requested from the user who triggers the action rule.     The `userInput` object has the following properties:      type : Type: `string` or `Object` : : : : The data type of the requested value. : : : : Supported types: : : : : * `entities.Field.dateTimeType` : : * `entities.Field.dateType` : : * `entities.Field.integerType` : : * `entities.Field.floatType` : : * `entities.Field.periodType` : : * `entities.Field.stringType` : : * `entities.Build` : : * `entities.EnumField` : : * `entities.Issue` : : * `entities.IssueTag` : : * `entities.OwnedField` : : * `entities.Project` : : * `entities.ProjectVersion` : : * `entities.UserGroup` : : * `entities.User`   description : Type: `string` : : : : The label for the control that collects additional information from the user.                        |
: | guard |  Issue~guardFunction  |  A function that is invoked to determine whether the action is applicable to an issue.                     |
: | action |  Issue~actionFunction  |  The function that is invoked when a user triggers this action.                     |
: | requirements |  [Requirements](v1-Requirements.html)  |  The fields and entities that must be available for the rule to run.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |  The object representation of the rule.                 |

Example
: ```JAVASCRIPT
: var entities = require('@jetbrains/youtrack-scripting-api/entities');
: exports.rule = entities.Issue.action({
: title: 'Log comments',
: command: 'log',
: guard: function(ctx) {
: return ctx.issue.isReported;
: },
: action: function(ctx) {
: ctx.issue.comments.forEach(function(comment) {
: console.log(comment.text);
: });
: }
: });
: ```

### createDraft

```JAVASCRIPT
static createDraft(project, reporter)
```

Creates a new issue draft.

Available since 2025.1

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | project |  [Project](v1-Project.html)  |  The project where the new issue draft belongs.                     |
: | reporter |  [User](v1-User.html)  |  The reporter of the issue draft.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Issue](#issue-entity)  |  The newly created issue draft.                 |

### createSharedDraft

```JAVASCRIPT
static createSharedDraft(project)
```

Creates a new shared issue draft in the specified project. Unlike [createDraft()](#createDraft), this method does not associate the draft with an individual reporter. Use the returned [Issue](#issue-entity) object to populate the draft.

```JAVASCRIPT
const entities = require('@jetbrains/youtrack-scripting-api/entities');

const draft = entities.Issue.createSharedDraft(ctx.issue.project);
draft.summary = 'Follow up with the customer';
draft.description = 'Add the details that should be available in the shared draft.';
```

Available since 2025.1

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | project |  [Project](v1-Project.html)  |  The project where the new issue draft belongs.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Issue](#issue-entity)  |  The newly created issue draft.                 |

### findByExtensionProperties

```JAVASCRIPT
static findByExtensionProperties(extensionPropertiesQuery)
```

Finds issues whose extension properties match the specified query.

Available since 2024.3.43260

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | extensionPropertiesQuery |  Object  |  An object that maps extension property names to the values to match.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Set](v1-Set.html).<[Issue](#issue-entity)>  |  The issues whose extension properties match the query.                 |

Example
: ```JAVASCRIPT
: {
: property1: "value1",
: property2: "value2"
: }
: ```

### findById

```JAVASCRIPT
static findById(id)
```

Finds an issue by its visible ID.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | id |  String  |  The issue ID.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Issue](#issue-entity)  |  The issue that is assigned the specified ID.                 |

Example
: ```JAVASCRIPT
: var myIssue = entities.Issue.findById("NP-15971");
: ```

### onChange

```JAVASCRIPT
static onChange(ruleProperties)
```

Creates a declaration of a rule that runs when an issue changes. The returned object is normally exported to the `rule` property. Otherwise, YouTrack does not treat it as a rule.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | ruleProperties |  Object  |  An object that defines the rule.                     |

Properties of ruleProperties
: | Name | Type | Description |
: | --- | --- | --- |
: | title |  string  |  The human-readable name of the rule. Displayed in the administrative UI in YouTrack.                     |
: | guard |  Issue~guardFunction  |    A function that determines the conditions for executing the rule.     If the guard condition is not met, the action specified in the rule is not applied to the issue.                       |
: | action |  Issue~actionFunction  |  The function that is invoked on an issue change.                     |
: | requirements |  [Requirements](v1-Requirements.html)  |  The fields and entities that must be available for the rule to run.                     |
: | runOn |  Object  |    Determines which issue events trigger the on-change rule.     When not specified, the rule is triggered on an issue change.     The `runOn` object has the following properties:      change : Type: `boolean` : : : : When `true`, the rule is triggered on an issue change.   removal : Type: `boolean` : : : : When `true`, the rule is triggered when an issue is logically deleted.                        |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |  The object representation of the rule.                 |

Example
: ```JAVASCRIPT
: var entities = require('@jetbrains/youtrack-scripting-api/entities');
: exports.rule = entities.Issue.onChange({
: title: 'On issue change, log its ID',
: action: function(ctx) {
: console.log(ctx.issue.id);
: }
: });
: ```

### onSchedule

```JAVASCRIPT
static onSchedule(ruleProperties)
```

Creates a declaration of a rule that runs on a schedule. The returned object is normally exported to the `rule` property. Otherwise, YouTrack does not treat it as a rule.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | ruleProperties |  Object  |  An object that defines the rule.                     |

Properties of ruleProperties
: | Name | Type | Description |
: | --- | --- | --- |
: | title |  string  |  The human-readable name of the rule. Displayed in the administrative UI in YouTrack.                     |
: | search |  string, function  |    A YouTrack search string or a function with no parameters that returns such a string.     The specified action is applied to all issues that match the search and belong to the project that this rule is attached to.                       |
: | cron |  string  |  A cron expression that specifies the interval for applying the rule.                     |
: | muteUpdateNotifications |  boolean  |  `true` if no notifications should be sent on changes made by this rule or any rule that reacted on a change made by this rule.                     |
: | modifyUpdatedProperties |  boolean  |    When `true`, updates applied by the workflow rule are reflected in the `updated` and `updatedBy` properties of the target entity.     Otherwise, the values for these properties remain unchanged.                       |
: | action |  Issue~actionFunction  |  The function that is invoked on schedule for each issue that matches the search.                     |
: | requirements |  [Requirements](v1-Requirements.html)  |  The fields and entities that must be available for the rule to run.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |  The object representation of the rule.                 |

Example
: ```JAVASCRIPT
: var entities = require('@jetbrains/youtrack-scripting-api/entities');
: exports.rule = entities.Issue.onSchedule({
: title: 'Log IDs of major issues every 5 seconds',
: search: '#Major',
: cron: '0/5 * * * * ?',
: action: function(ctx) {
: console.log(ctx.issue.id);
: }
: });
: ```

### sla

```JAVASCRIPT
static sla(ruleProperties)
```

Creates a declaration of a custom SLA policy. An SLA policy defines the time goals for the replies from staff and request resolution.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | ruleProperties |  Object  |  An object that defines the SLA policy.                     |

Properties of ruleProperties
: | Name | Type | Description |
: | --- | --- | --- |
: | title |  string  |  The human-readable name of the SLA policy. Displayed in the administrative UI in YouTrack.                     |
: | guard |  Issue~slaGuardFunction  |  A function that is invoked to determine whether the policy is applicable to the ticket.                     |
: | onEnter |  Issue~slaEnterFunction  |  A function that is invoked when the SLA policy starts applying to the ticket.                     |
: | action |  Issue~slaActionFunction  |    The function that is invoked when the policy needs to update the ticket.     For example, it might pause the timers according to the SLA settings.                       |
: | onBreach |  Issue~slaBreachFunction  |    A function that is invoked when one of the SLA goals is breached.     The name of the field that caused the breach is stored in the `ctx.breachedField` parameter.                       |
: | requirements |  [Requirements](v1-Requirements.html)  |    The fields and entities that must be available for the rule to run.     When you define a custom field of date and time type in the requirements, YouTrack handles this field as an SLA timer.                       |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |  The object representation of the SLA policy.                 |

Example
: ```JAVASCRIPT
: const entities = require('@jetbrains/youtrack-scripting-api/entities');
: exports.rule = entities.Issue.sla({
: title: "Support",
: guard: (ctx) => {
: return false;
: },
: onEnter: (ctx) => {
: console.log('onEnter', ctx.issue.id);
: },
: action: (ctx) => {
: console.log('action', ctx.issue.id);
: },
: onBreach: (ctx) => {
: console.log('onBreach', ctx.issue.id, ctx.breachedField);
: },
:
: requirements: {
: firstReplyField: {
: type: entities.Field.dateTimeType,
: name: 'First Reply'
: },
: state: {
: type: entities.State.fieldType,
: name: 'State'
: }
: }
: });
: ```

### stateMachine

```JAVASCRIPT
static stateMachine(ruleProperties)
```

Creates a declaration of a state-machine rule. The state machine restricts transitions between values in a custom field. It can run actions when the field is set to a value, changes from a value, or moves between two specific values. The returned object is normally exported to the `rule` property. Otherwise, YouTrack does not treat it as a rule.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | ruleProperties |  Object  |  An object that defines the rule.                     |

Properties of ruleProperties
: | Name | Type | Description |
: | --- | --- | --- |
: | title |  string  |  The human-readable name of the rule. Displayed in the administrative UI in YouTrack.                     |
: | fieldName |  string  |    The name of a field that is managed by the state-machine rule.     Declare either `fieldName` or `stateFieldName`, not both.                       |
: | stateFieldName |  string  |    An alias for `ruleProperties.fieldName` for building state-machines per issue type.     When both `stateFieldName` and `fieldName` are declared, an exception is thrown.                       |
: | states |  Object  |    A list of values for a custom field and the possible transitions between them.     Declare either `states` or `defaultStateMachine`, not both.                       |
: | defaultMachine |  Object  |    An alias for `ruleProperties.states` for building state-machines per issue type.     When both `defaultMachine` and `states` are declared, an exception is thrown.                       |
: | typeFieldName |  string  |  The name of a field that defines which state-machine applies to the managed field.                     |
: | alternativeMachines |  Object  |    An object that contains the definitions for one or more state-machines that apply to different types of issues.     Object keys are the possible values of the field defined by `ruleProperties.typeFieldName`. Object values have the same structure shown for `states` in the example.     This parameter is mandatory when `ruleProperties.typeFieldName` is specified.                       |
: | requirements |  [Requirements](v1-Requirements.html)  |  The fields and entities that must be available for the rule to run.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |  The object representation of the rule.                 |

Example
: ```JAVASCRIPT
: var entities = require('@jetbrains/youtrack-scripting-api/entities');
: exports.rule = entities.Issue.stateMachine({
: title: 'Status state machine',
: fieldName: 'Status',
: states: {
: Open: {
: initial: true,
: transitions: {
: start: {
: targetState: 'In progress'
: }
: }
: },
: 'In progress': {
: onEnter: function(ctx) {
: ctx.issue.fields.Assignee = ctx.currentUser;
: },
: transitions: {
: fix: {
: targetState: 'Fixed'
: },
: reopen: {
: targetState: 'Open'
: }
: }
: },
: Fixed: {
: transitions: {
: }
: }
: },
: requirements: {
: Assignee: {
: type: entities.User.fieldType
: }
: }
: });
: ```

### addAttachment

```JAVASCRIPT
addAttachment(content, name, charset, mimeType)
```

Attaches a file to the issue. In the current transaction, this method makes `issue.attachments.isChanged` return `true`.

Available since 2019.2.53994

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | content |  InputStream, String, [JsonForIssueAddAttachment](v1-JsonForIssueAddAttachment.html)  |  The file content in binary form or as a base64 data URI. Base64 content must use the `data:[MIME type];base64,[content]` syntax. Alternatively, pass an object described by [JsonForIssueAddAttachment](v1-JsonForIssueAddAttachment.html).                     |
: | name |  String  |  The name of the file.                     |
: | charset |  String  |  The character encoding of the file. This parameter is used only for text files.                     |
: | mimeType |  String  |  The MIME type of the file.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [IssueAttachment](v1-IssueAttachment.html)  |  The attachment that is added to the issue.                 |

### addComment

```JAVASCRIPT
addComment(text, author)
```

Adds a comment to the issue. In the current transaction, this method makes `issue.comments.isChanged` return `true`.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | text |  String, [JsonForIssueAddComment](v1-JsonForIssueAddComment.html)  |  The comment text, or an object described by [JsonForIssueAddComment](v1-JsonForIssueAddComment.html).                     |
: | author |  [User](v1-User.html)  |  The author of the comment.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [IssueComment](v1-IssueComment.html)  |  A newly created comment.                 |

### addTag

```JAVASCRIPT
addTag(name)
```

Adds a tag with the specified name to an issue. YouTrack adds the first matching tag that is visible to the current user. If a match is not found, a new private tag is created for the current user.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | name |  String  |  The name of the tag to add to the issue.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Tag](v1-Tag.html)  |  The tag that has been added to the issue.                 |

### addWorkItem

```JAVASCRIPT
addWorkItem(description, date, author, duration, type)
```

Adds a work item to the issue.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | description |  String, [JsonForIssueAddWorkItem](v1-JsonForIssueAddWorkItem.html)  |  The work item description, or an object described by [JsonForIssueAddWorkItem](v1-JsonForIssueAddWorkItem.html).                     |
: | date |  Number  |  The date that is assigned to the work item.                     |
: | author |  [User](v1-User.html)  |  The user who performed the work.                     |
: | duration |  Number  |  The work duration in minutes.                     |
: | type |  [WorkItemType](v1-WorkItemType.html)  |  The work item type.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [IssueWorkItem](v1-IssueWorkItem.html)  |  The new work item.                 |

### afterMinutes

```JAVASCRIPT
afterMinutes(initialTime, minutes, calendar, considerPauses)
```

Adds the specified number of minutes to a specified starting point in time.

Available since 2023.1

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | initialTime |  Number  |  A timestamp for the starting point in time. YouTrack adds the specified number of minutes to this point.                     |
: | minutes |  Number  |  The number of minutes to add to the starting point.                     |
: | calendar |  [Calendar](v1-Calendar.html)  |    The SLA settings for the business hours that should be considered when adding minutes to the starting point.     If the result falls outside the business hours, the extra minutes are automatically transferred to the next business day.                       |
: | considerPauses |  Boolean  |  A switcher that determines whether to consider the effects of the `pauseSLA()` and `resumeSLA()` methods when adding specified minutes to the starting point.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Number  |  A timestamp after adding the specified number of minutes.                 |

### applyCommand

```JAVASCRIPT
applyCommand(command, runAs)
```

Applies a command to the issue. The optional `runAs` user supplies the permissions used to execute the command. It does not impersonate that user for issue history: the update is still attributed to the user under whose account the workflow is running.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | command |  String  |  The command that is applied to the issue.                     |
: | runAs |  [User](v1-User.html)  |    Specifies the user whose permissions are used to apply the command.     If this parameter is not set, the permissions of the current user are used.     This parameter does not change the user recorded in issue history.                       |

### becomes

```JAVASCRIPT
becomes(fieldName, expected)
```

Checks whether a field is set to an expected value in the current transaction.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field to check.                     |
: | expected |  string  |  The expected value.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the field is set to the expected value, returns `true`.                 |

### canBeReadBy

```JAVASCRIPT
canBeReadBy(fieldName, user)
```

Checks whether a user has permission to read the field.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field.                     |
: | user |  [User](v1-User.html)  |  The user for whom the permission to read the field is checked.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the user can read the field, returns `true`.                 |

### canBeWrittenBy

```JAVASCRIPT
canBeWrittenBy(fieldName, user)
```

Checks whether a user has permission to update the field.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field.                     |
: | user |  [User](v1-User.html)  |  The user for whom the permission to update the field is checked.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the user can update the field, returns `true`.                 |

### clearAttachments

```JAVASCRIPT
clearAttachments()
```

Removes all of the attachments from the issue.

### copy

```JAVASCRIPT
copy(project)
```

Creates a copy of the issue.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | project |  [Project](v1-Project.html)  |  The [Project](v1-Project.html) where the new issue is created. Available since 2018.1.40575.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Issue](#issue-entity)  |  The copy of the original issue.                 |

### hasTag

```JAVASCRIPT
hasTag(tagName, ignoreVisibilitySettings)
```

Checks whether the specified tag is attached to an issue.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | tagName |  String  |  The name of the tag to check for the issue.                     |
: | ignoreVisibilitySettings |  Boolean  |    When `true`, checks all matching tags without regard to their visibility settings.     When `false` (default), checks only matching tags that are visible to the current user.                       |

Return Value
: | Type | Description |
: | --- | --- |
: |  Boolean  |  If the specified tag is attached to the issue, returns `true`.                 |

### is

```JAVASCRIPT
is(fieldName, expected)
```

Checks whether a field is equal to an expected value.

Available since 2019.2.55603

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field to check.                     |
: | expected |  string  |  The expected value.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the field is equal to the expected value, returns `true`.                 |

### isChanged

```JAVASCRIPT
isChanged(fieldName)
```

Checks whether the value of a field is changed in the current transaction.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field to check.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the value of the field is changed in the current transaction, returns `true`.                 |

### isVisibleTo

```JAVASCRIPT
isVisibleTo(user)
```

Checks whether the specified user can access the issue.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | user |  [User](v1-User.html)  |  The user to check.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Boolean  |  If the specified user can access the issue, returns `true`.                 |

### oldValue

```JAVASCRIPT
oldValue(fieldName)
```

Returns the previous value of a single-value field before an update was applied. If the field is not changed in the current transaction, returns `null`.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  Object  |    If the field is changed in the current transaction, returns the previous value of the field.     Otherwise, returns `null`.                   |

### pauseSLA

```JAVASCRIPT
pauseSLA()
```

Pauses the timers for the current SLA applied to the issue.

Available since 2023.1

### removeTag

```JAVASCRIPT
removeTag(name)
```

Removes a tag with the specified name from the issue. If the tag is not attached, nothing happens. The method searches tags owned by the current user first, followed by all other visible tags.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | name |  String  |  The name of the tag to remove from the issue.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  [Tag](v1-Tag.html)  |  The tag that has been removed from the issue.                 |

### renderMarkup

```JAVASCRIPT
renderMarkup(text)
```

Converts Markdown text to HTML for use in formatted notifications.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | text |  String  |  The string of text to convert to HTML.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  String  |  The rendered HTML.                 |

Example
: ```JAVASCRIPT
: issue.Assignee.notify('Comment added:', issue.renderMarkup(comment.text));
: ```

### required

```JAVASCRIPT
required(fieldName, message)
```

Asserts that a value is set for a field. If a value for the required field is not set, the specified message is displayed in the user interface.

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field to check.                     |
: | message |  string  |  The message that is displayed to the user that describes the field requirement.                     |

### resumeSLA

```JAVASCRIPT
resumeSLA()
```

Resumes the timers for the current SLA applied to the issue.

Available since 2023.1

### setDefaultFieldValues

```JAVASCRIPT
setDefaultFieldValues()
```

Sets the default custom field values for the issue. Applies only for empty fields.

Available since 2025.3

### tag

```JAVASCRIPT
tag(tag)
```

Applies the tag to the issue.

Available since 2025.3

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | tag |  [Tag](v1-Tag.html)  |  The tag object.                     |

### untag

```JAVASCRIPT
untag(tag)
```

Removes the tag from the issue.

Available since 2025.3

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | tag |  [Tag](v1-Tag.html)  |  The tag object.                     |

### was

```JAVASCRIPT
was(fieldName, expected)
```

Checks whether a field was equal to an expected value prior to the current transaction.

Available since 2019.2.55603

Parameters
: | Name | Type | Description |
: | --- | --- | --- |
: | fieldName |  string  |  The name of the field to check.                     |
: | expected |  string  |  The expected value.                     |

Return Value
: | Type | Description |
: | --- | --- |
: |  boolean  |  If the field was equal to the expected value, returns `true`.                 |

## See also

[Fields](v1-Fields.html) [Set](v1-Set.html) [Requirements](requirements.html) [Use the YouTrack JavaScript API](using-workflow-api.html)

