YouTrack Standalone 7.0 Help

Users

You can reference a user in the following contexts:

ContextDescription
loggedInUserThis keyword references the user who is currently logged in to YouTrack.
AssigneeThis default custom field is assigned a user data type. This means that you can return properties and use methods for a user account when you reference this custom field. The same guidelines apply for any custom field that is assigned a user data type.
issue.project.leaderThis property of a project is also assigned a user data type.
ownerA property of a custom field that uses the ownedField type. This property is assigned the user data type.
project.getUserThis method returns a specific user account in the context of the current project.

You can also reference a specific user login as a literal value.

User Properties

The following properties of a user account can be accessed with a workflow.

PropertyDescription
login: stringThe username of a user account. For example, root.
fullName: stringThe full name of a user. For example, John Smith.
email: stringThe email address of a user account. For example, j.smith@example.com.

User-related Methods

The following methods are available for use with users. See also User Properties.

getVisibleName

SyntaxgetVisibleName(): string
DescriptionReturns the full name of the specified user. If the full name is not set, the username is returned.

isBanned

SyntaxisBanned(): Boolean
DescriptionChecks whether the user account is banned.
Example
if (Assignee.isBanned()) { Assignee = null; }

hasRole

SyntaxhasRole(role: string): Boolean
DescriptionChecks whether the user has the specified role in any project.
Example
if (loggedInUser.hasRole("Developer")) { Assignee = loggedInUser; }

isInGroup

SyntaxisInGroup(): string
DescriptionChecks whether the user is a member of the specified group.
Example
when Assignee.changed && Assignee != null { if (permittedGroup != null && !Assignee.isInGroup(permittedGroup.name)) { message(l10n ( Please take into account that new assignee ' {Assignee.fullName} ' isn't included into the visibility group ' {permittedGroup.name} '!)); } }

createNewIssue

SyntaxcreateNewIssue(projectShortName: String): issue
ParametersprojectShortNameThe ID of the project in which the issue is created.
DescriptionCreates a new issue in the specified project.
Example
var todoIssue = loggedInUser.createNewIssue(project.shortName); todoIssue.summary = "iPhone :" + issue.summary; todoIssue.tags.add(iOSTag); tags.add(iOSTag);

getIssues

SyntaxgetIssues(context: SavedSearch, query: String): sequence of issues
ParameterscontextThe name of the saved search to use as the context for the search query. The default context is Everything.
queryThe search query. Can be an empty string.
DescriptionReturns a list of issues based on the specified context and search query.
Example
for each notMyIssue in loggedInUser.getIssues({savedSearch: Reported by me}, "for: -me") { notMyIssue.Assignee = loggedInUser; }
Variations
var issues = project.leader.getIssues(Everything, ""); var issues = project.leader.getIssues({savedSearch: Unassigned in A}, ""); var issues = project.leader.getIssues({savedSearch: Unassigned in A}, "Priority: Critical");

watchIssue

SyntaxwatchIssue(issue: issue)
ParametersissueThe issue to which the user is added as a watcher.
DescriptionAdds the current user to the issue as a watcher (add Star tag).
Example
if (loggedInUser.isInGroup("developers") && loggedInUser.hasRole("Developer")) { loggedInUser.watchIssue(issue); } else { loggedInUser.unwatchIssue(issue); }

unwatchIssue

SyntaxunwatchIssue(issue: Issue)
ParametersissueThe issue to from which the user is removed as a watcher.
DescriptionRemoves the current user from the list of watchers for the issue (remove Star tag).
Example
if (loggedInUser.isInGroup("developers") && loggedInUser.hasRole("Developer")) { loggedInUser.watchIssue(issue); } else { loggedInUser.unwatchIssue(issue); }

getTag

SyntaxgetTag(tagName: string, createIfNotExists: Boolean): tag
ParameterstagNameThe name of the tag.
createIfNotExistsIf true and the specified tag does not exist or is not visible to the user and the user has permission to create tags, a new tag with the specified name is created.
DescriptionReturns a tag that is visible to the user.
Example
var createIfNotExist = loggedInUser.getSharedTag("iOS") == null; var iOSTag = loggedInUser.getTag("iOS", createIfNotExist);

getSharedTag

SyntaxgetSharedTag(tagName: string): tag
ParameterstagNameThe name of the tag.
DescriptionReturns a tag with the specified name that is shared with but not owned by the user. If such a tag does not exist, a null value is returned.
Example
var createIfNotExist = loggedInUser.getSharedTag("iOS") == null; var iOSTag = loggedInUser.getTag("iOS", createIfNotExist);

canVoteIssue

SyntaxcanVoteIssue(issue: issue): Boolean
DescriptionChecks whether the user is able to vote for the specified issue.
Example
var user = project.getUser("user"); if (user.canVoteIssue(issue)) { user.voteIssue(issue); }

voteIssue

SyntaxvoteIssue(issue: issue)
ParametersissueThe issue to which the vote is added.
DescriptionAdds a vote on behalf of the user to the issue, if allowed.
Example
>var user = project.getUser("user"); if (user.canVoteIssue(issue)) { user.voteIssue(issue); }

canUnvoteIssue

SyntaxcanUnvoteIssue(issue: issue): Boolean
DescriptionChecks whether the user is able to remove their vote from the specified issue.

unvoteIssue

SyntaxunvoteIssue(issue: issue)
ParametersissueThe issue from which the vote is removed.
DescriptionRemoves a vote on behalf of the user from the issue, if allowed

notify

Syntaxnotify(subject: string, body: string, ignoreNotifyOnOwnChangesSetting: Boolean)
ParameterssubjectThe subject line of the email notification.
bodyThe message text of the email notification.
ignoreNotifyOnOwnChangesSettingIf false, the message is not sent when changes are performed on behalf of the current user. The corresponding flag is unchecked. Otherwise, the message is sent anyway.
DescriptionSends an email notification to the email address that is set in the user profile.
Example
var projectLeader = project.leader; projectLeader.notify("Attention","Please pay attention to " + getId()); projectLeader.sendJabber("Please look at " + getId());

sendMail

SyntaxsendMail(subject: string, body: string)
ParameterssubjectThe subject line text of the email notification.
bodyThe message text of the email notification.
DescriptionAn alias for notify(subject, body, true)
Example
sendMail(Reporter email, "[YouTrack, Commented]", "New comment was added: " + comments.added.first.text));

sendJabber

SyntaxsendJabber(text: string)
ParameterstextThe message text for the Jabber notification.
DescriptionSends a notification message over Jabber. Similar to notify method, the message won't be sent on own changes and corresponding flag unchecked.
Example
project.leader.sendJabber("Please pay attention to " + getId());
Last modified: 29 September 2016