Fields
Represents the custom fields that are used in an issue. The actual set of custom fields that are used for each issue is configured on a per-project basis. The properties shown here correspond with the default custom fields in YouTrack. Additional custom fields that have been attached to a project are also available.
Properties
Name | Type | Description | Read-only |
---|---|---|---|
'Affected versions' | | A custom field that stores data as a Set<ProjectVersion> type. | |
'Due Date' | | A custom field that stores data as a Number type. | |
'Fix versions' | | A custom field that stores data as a Set<ProjectVersion> type. | |
'Fixed in build' | | A custom field that stores data as a Build type. | |
Assignee | | A custom field that stores data as a User type. | |
Priority | | A custom field that stores data as a EnumField type. | |
State | | A custom field that stores data as a State type. | |
Subsystem | | A custom field that stores data as a OwnedField type. | |
Type | | A custom field that stores data as a EnumField type. |
Methods
becomes
static becomes(field, expected)
Checks whether the value for a custom field is set to an expected value in the current transaction.
Parameters
Name | Type | Description |
---|---|---|
field | | The field to check. |
expected | | The expected value. |
Return Value
Type | Description | |
---|---|---|
| If the field is set to the expected value, returns `true`. |
canBeReadBy
static canBeReadBy(field, user)
Checks whether a user has permission to read the custom field.
Parameters
Name | Type | Description |
---|---|---|
field | | The custom field to check for read access. |
user | | The user for whom the permission to read the custom field is checked. |
Return Value
Type | Description | |
---|---|---|
| If the user can read the field, returns `true`. |
canBeWrittenBy
static canBeWrittenBy(field, user)
Checks whether a user has permission to update the custom field.
Parameters
Name | Type | Description |
---|---|---|
field | | The custom field to check for update access. |
user | | The user for whom the permission to update the custom field is checked. |
Return Value
Type | Description | |
---|---|---|
| If the user can update the field, returns `true`. |
isChanged
static isChanged(field)
Checks whether the custom field is changed in the current transaction.
Parameters
Name | Type | Description |
---|---|---|
field | | The name of the custom field (for example, 'State') or a reference to the field that is checked. |
Return Value
Type | Description | |
---|---|---|
| If the value of the field is changed in the current transaction, returns `true`. |
oldValue
static oldValue(field)
Returns the previous value of a single-valued custom field before an update was applied. If the field is not changed in the transaction, this value is equal to the current value of the field.
Parameters
Name | Type | Description |
---|---|---|
field | | The name of the custom field (for example, 'State') or a reference to the field for which the previous value is returned. |
Return Value
Type | Description | |
---|---|---|
| If the custom field is changed in the current transaction, the previous value of the field. Otherwise, the current value of the field. |
required
static required(fieldName, message)
Asserts that a value is set for a custom 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 | | The name of the custom field to check. |
message | | The message that is displayed to the user that describes the field requirement. |