YouTrack Standalone 7.0 Help

Sequences

The workflow programming language contains a set of predefined sequences. These sequences include issues, comments, tags, users, issue links, custom field enumerations, versions, builds, ownedFields, groups, states, static elements for sets of values, and strings. The workflow language does not let you create your own sequence of elements.

When you reference a sequence, you can check each element in the sequence for additional properties that are available for the sequence type. For example, issue.comments returns a sequence of IssueComment elements. You can find the first comment that was added to the issue with the operations added and first. You can then access the properties of the first IssueComment, such as text or author. A statement that returns this property would look something like this:

if (comments.added.isNotEmpty) { text = comments.added.first.text;

You can also iterate over the elements in a sequence with a for each statement. For example:

for each version in Fix versions { if (version.releaseDate < now) { project.leader.notify("Overdue version!", "The issue " + getId()+ " has overdue fix version."); } }

Sequence-related Methods

The following methods are available for use with sequences. See also Sequence Properties.

contains

Syntaxcontains(element: sequence type): Boolean
ParameterselementThe element to check for in the sequence.
DescriptionChecks whether a sequence contains a specific element.
Example
if (Fix versions.contains({7.0})){ Priority = {Critical}; }

add

Syntaxadd(element: sequence type)
ParameterselementThe element to add to the sequence.
DescriptionAdds an element to the specified sequence.
Example
Fix versions.add({Backlog});

clear

Syntaxclear()
DescriptionRemoves all of the elements in the sequence.
Example
relates to.clear;

remove

Syntaxremove(element: sequence type)
ParameterselementThe element to remove from the sequence.
DescriptionRemoves an element from the specified sequence.
Example
Fix versions.remove({Next Release});

Sequence-related Operations

The following operations are available for use with sequences.

OperationDescription
first: [sequence type]Returns the first element of the sequence. Returns null on empty sequences.
last: [sequence type]Returns the last element of the sequence. Returns null on empty sequences.
isEmpty: BooleanTrue if the sequence is empty.
isNotEmpty: BooleanTrue if the sequence is not empty.
added: sequence<[sequence type]>Returns a sequence of elements which were added to the sequence during the current transaction.
removed: sequencesequence<[sequence type]>A sequence of elements which were removed from the sequence during current transaction.
Last modified: 29 September 2016