YouTrack Standalone 2017.3 Help

entities

Contains definitions for the entities in YouTrack that are accessible to workflows.

Types

This module supports the following object types:

TypeDescription
AgileRepresents an agile board and the set of sprints that belong to the board.
BaseEntityThe common ancestor for all entity types.
BaseWorkItemThe base class for issue work items.
BuildRepresents a value that is stored in a custom field that stores a build type.
BundleProjectCustomFieldRepresents a custom field in a project that stores an predefined set of values.
EnumFieldRepresents a value in a custom field that stores a predefined set of values.
FieldRepresents a value that is stored in a custom field. The custom fields themselves are represented by the Fields class.
FieldsContains all issue custom fields.
GroupProjectCustomFieldRepresents a custom field in a project that stores a UserGroup type.
IssueRepresents an issue in YouTrack.
IssueAttachmentRepresents a file that is attached to an issue.
IssueCommentRepresents a comment that is added to an issue.
IssueLinkPrototypeRepresents an issue link type.
IssueTagRepresents a tag.
IssueWorkItemRepresents a work item that has been added to an issue.
IteratorAn object that enables traversal through the elements in a collection.
JsonForIssueAddComment
JsonForIssueAddWorkItem
JsonForIssueConstructor
JsonForUserNotify
OwnedFieldRepresents a value in a custom field that has a user associated with it, a so-called owner.
PeriodProjectCustomFieldRepresents a custom field in a project that stores a value as a period type. We use org.joda.time.Period as a base class for period values. While you can read the class documentation at http://joda-time.sourceforge.net/apidocs/org/joda/time/Period.html, please note that we support only class members which use the Period class and primitive types like String and int.
ProjectRepresents a YouTrack project.
ProjectCustomFieldRepresents a custom field that is available in a project.
ProjectVersionRepresents a value in a custom field that stores a version type.
RequirementA single element in a set of Requirements
RequirementsThe `Requirements` object serves two purposes. First, it functions as a safety net. It specifies the set of entities that must exist for a rule to work as expected. Whenever one or more rule requirements are not met, corresponding errors are shown in the workflow administration UI. The rule is not executed until all of the problems are fixed. Second, it functions as a reference. Each entity in the requirements is plugged into the `context` object, so you can reference entities from inside your context-dependent functions (like an `action` function). There are two types of requirements: project-wide and system-wide. Project-wide requirements contain a list of custom fields that must be attached to each project that uses the rule as well as the required values from the sets of values for each custom field. System-wide requirements contain a list of other entities that must be available in YouTrack. This includes users, groups, projects, issues, tags, saved searches, and issue link types.
SavedQueryRepresents a saved search.
SetThe `Set` object stores unique values of any type, whether primitive values or object references. The Set is used as storage for all multi-value objects in this API: custom fields that store multiple values, issue links, issues in a project, and so on. You can access single values in the collection directly (see first(), last(), get(index)), use an iterator (see entries(), values()), or traverse with forEach(visitor) and find(predicate) methods. The workflow API is based on ECMAScript 5.1. This Set implementation mimics the functionality supported by the ES 6 Set interface.
SimpleProjectCustomFieldBase class for custom fields that store simple values like strings and numbers.
SprintRepresents a sprint that is associated with an agile board. Each sprint can include issues from one or more projects.
StateRepresents a value in a custom field that stores a state type.
UserRepresents a user account in YouTrack.
UserGroupRepresents a group of users.
UserProjectCustomFieldRepresents a custom field in a project that stores values as a user type.
WatchFolderRepresents a common ancestor of classes that represent tags and saved searches.
WorkItemTypeRepresents a work type that can be assigned to a work item.

Functions


actionFunction

actionFunction(ctx, ctx.issue, ctx.currentUser)

This function is called by different events depending on the rule type: when a change is applied to an issue (on-change rules), when a command is executed (action rules), or according to a predefined schedule (scheduled rules). This function is called separately for each related issue.

Parameters

NameTypeDescription
ctx Object The execution context. Along with the parameters listed below, the context also contains objects that you describe in the Requirements.
ctx.issue Issue The current issue.
ctx.currentUser User The user who executes the rule.

Example

action: function(ctx) { console.log('Action for issue ' + ctx.issue.id); }

 

guardFunction

guardFunction(ctx, ctx.issue, ctx.currentUser)

This function is called to determine whether an action function can be applied to an issue. Guard functions are used in on-change rules, action rules, and in transitions between values of a state-machine rule. On-schedule rules also support guard functions, but this rule type includes a `search` property that has a similar purpose.

Parameters

NameTypeDescription
ctx Object The execution context. Along with the parameters listedbelow, the context also contains objects that you describe as Requirements.
ctx.issue Issue The current issue.
ctx.currentUser User The user who executes the rule.

Example

guard: function(ctx) { return ctx.issue.State.isResolved; }

 

Last modified: 17 November 2017