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
add
Syntax | add(element: sequence type) | |
---|---|---|
Parameters | element | The element to add to the sequence. |
Description | Adds an element to the specified sequence. | |
Example | Fix versions.add({Backlog}); |
clear
Syntax | clear() | |
---|---|---|
Description | Removes all of the elements in the sequence. | |
Example | relates to.clear; |
remove
Syntax | remove(element: sequence type) | |
---|---|---|
Parameters | element | The element to remove from the sequence. |
Description | Removes an element from the specified sequence. | |
Example | Fix versions.remove({Next Release}); |
Sequence-related Operations
The following operations are available for use with sequences.