Entities
Workflow module Entities from package @jetbrains/youtrack-scripting-api
Contains definitions for the entities in YouTrack that are accessible to workflows.
Module types
- Agile
- BaseComment
- BaseEntity
- BaseWorkItem
- Build
- BundleProjectCustomField
- ChangesProcessor
- EnumField
- Field
- Fields
- GroupProjectCustomField
- Issue
- IssueAttachment
- IssueComment
- IssueLinkPrototype
- IssueTag
- IssueWorkItem
- Iterator
- JsonForIssueAddComment
- JsonForIssueAddWorkItem
- JsonForIssueConstructor
- JsonForUserNotify
- OwnedField
- PeriodProjectCustomField
- PersistentFile
- Project
- ProjectCustomField
- ProjectVersion
- Requirement
- Requirements
- SavedQuery
- Set
- SimpleProjectCustomField
- Sprint
- State
- TextProjectCustomField
- User
- UserGroup
- UserProjectCustomField
- VcsChange
- VcsServer
- WatchFolder
- WorkItemType
Module functions
actionFunction
actionFunction(ctx, ctx.issue, ctx.currentUser, ctx.isSilentOperation)
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 separatelyfor each related issue.
action: function(ctx) {
console.log('Action for issue ' + ctx.issue.id);
}
Parameters:
Name | Type | Description |
---|---|---|
ctx | | The execution context. Along with the parameters listed below,the context also contains objects that you describe in the Requirements. |
ctx.issue | | The current issue. |
ctx.currentUser | | The user who executes the rule. |
ctx.isSilentOperation | | When `true`, the rule is triggered in reaction to a command that is applied without notification.When `false`, the rule is triggered in reaction to a command that is applied normally. Available since 2017.4.38771. |
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.
guard: function(ctx) {
return ctx.issue.State.isResolved;
}
Parameters:
Name | Type | Description |
---|---|---|
ctx | | The execution context. Along with the parameters listed below,the context also contains objects that you describe as Requirements. |
ctx.issue | | The current issue. |
ctx.currentUser | | The user who executes the rule. |