๐Ÿš€ Effective since April 2020 and JWT version 2.9.0 Automation Toolbox for Jira is fully integrated into our top rated app Jira Workflow Toolbox (JWT)๐Ÿš€

Overview

The expression parser offers multiple functions to manage user-, group- and role-related information.

Available functions

FunctionInputReturned value
isInGroup(string user_name, string group_name)

STRING

Checks if a user is in a group. BOOLEAN

Argument user_name can also be a comma separated list of user names, group names or role names. In that case the function will return true only if all users in the list, groups of the list, and in the roles of the list, are in the group in the second argume{nt.

Example

isInGroup(%{...assignee}, "jira-developers") returns true if Assignee in in group jira-developers.

isInRole(string user_name, string role_name)

STRING

Checks if a user or group of users plays a role in current project. BOOLEAN

Argument user_name can also be a comma separated list of user names, group names or role names. In that case the function will return true only if all users in the list, groups of the list, and in the roles of the list, are in project role in the second argument, for current project.

Example

isInRole(%{...reporter}, "Testers") returns true in Reporter is in project role Testers.
isInRole(string user_name, string role_name, string project_key)

STRING

Checks if a user or group of users plays a role in a certain project. BOOLEAN

Argument user_name can also be a comma separated list of user names, group names or role names. In that case the function will return true only if all users in the list, groups of the list, and in the roles of the list, are in role in the second argument, for the project in the third argument.

Example

isInRole(%{...currentUser}, "Developers", "CRM") returns true in Current user is in project role Developers in project with key "CRM".
isActive(string user_name)

STRING

Checks if a user is active. BOOLEAN

Argument user_name can also be a comma separated list of user names, group names or role names. In that case the function will return true only if all users in the list, groups of the list, and in the roles of the list, are active.

Example

isActive(%{...componentLeads}) returns true if all users who are component leaders in current project are active.
userFullName(string user_name)

STRING

Returns a STRING with the full name of the user in argument user_name.

Argument user_name is a string with a user name, not to be confused with user full name.

Example

userFullName(%{...currentUser}) returns the user's full name of current user.
userFullName(string list user_names)

STRING []

Returns a STRING [] with the full names of the users in argument user_names.

Argument user_names is a string list with user names, not to be confused with users full names.

Example

userFullName(toStringList(%{...watchers})) returns a list with the users full names of current issue's watchers.
userEmail(string user_name)

STRING

Returns a STRING with the email of the user in argument user_name.

Argument user_name is a string with a user name, not to be confused with user full name.

Example

userEmail(%{...currentUser}) returns the email of current user.


userEmail(string list user_names)

STRING []

Returns a STRING [] with the emails of the users in argument user_names.

Argument user_names is a string list with a user names, not to be confused with users full names.

Example

userEmail(toStringList(%{...watchers})) returns a list with the emails of current issue's watchers.
fullNameToUser(string fullName)

STRING

Returns a STRING with the name of a user whose full name is equal to argument fullName.

Returned value is a string with a user name.

usersWithEmail(string email)

STRING

Returns a STRING [] with the user names of those users with emails equal to argument email.

In case that only one user is expected, function first(string list) can be used to extract a string with its user name.

userProperty(string propertyName, string userName)

STRING

Returns the STRING value of the user property with name propertyName which belongs to user with user name userName.

If the user doesn't have the property, "" will be returned.

userProperty(string propertyName, string list userNames)

STRING

Returns the STRING [] of values of the user property with name propertyName in all the users whose names are contained in userNames.

The output will contain as many strings as users have the property set.

usersInRole(string projectRoleName)

STRING

Returns the STRING [] of user names (not be confused with full user name) of those active users playing project role with name projectRoleName in current issue's project. Parameter projectRoleName can be a comma separated list of project role names, returning the users that play any of the project roles.

usersInRole(string projectRoleName, string projectKey

STRING

Equivalent to the previous function that returns a STRING [] with extra argument projectKey for selecting the project argument projectRoleName refers to.

usersInGroup(string groupName)

STRING

Returns the STRING [] of user names of those active users in group with name groupName.

Parameter groupName can be a comma separated list of group names, returning the users that belong to any of the groups.

rolesUserPlays(string userName)

STRING

Returns the STRING [] of role names of those project roles the user with name userName plays in current project.

Parameter userName can also be a comma separated list of user names, group names and project role names, returning the list of project roles for those users represented by input argument.

rolesUserPlays(string userName, string projectKey)

STRING

Returns the STRING [] of role names of those project roles the user with name userName plays in project with key projectKey.

Parameter userName can also be a comma separated list of user names, group names and project role names, returning the list of project roles for those users represented by input argument.

groupsUserBelongsTo(string userName)

STRING

Returns the STRING [] of group names of those groups the user with name userName belongs to.

Parameter userName can also be a comma separated list of user names, group names and project role names, returning the list of project roles for those users represented by input argument.

defaultUserForRole(string projectRoleName)

STRING

Returns the STRING of the user name of the Assign to project role project role with name projectRoleName in current issue's project, or "" if no default user is defined for the project role.

defaultUserForRole(string projectRoleName, string projectKey)

STRING

Equivalent to the previous STRING function but with extra argument projectKey for selecting the project argument projectRoleName refers to.

lastAssigneeInRole(string projectRoleName)

STRING

Returns the STRING of user name of the last user who had current issue assigned, and currently plays project role with name projectRoleName in current issue's project, or "" if current issue was never assigned to a user currently in the project role.

lastAssigneeInRole(string projectRoleName, string issueKey)

STRING

Returns theSTRING of  user name of the last user who had issue with key issueKey assigned, and currently plays project role with name projectRoleName in current issue's project, or null if current issue was never assigned to a user currently in the project role.

leastBusyUserInRole(string projectRoleName)

STRING

Returns the  name of the active user playing project role with name projectRoleName in current issue's project, and has the lower number of issues with resolution empty assigned; or "" if there isn't any user in the project role. Parameter projectRoleName can be a comma separated list of project role names, returning the least busy users among the project roles.

Example

leastBusyUserInRole("Developers") returns the STRING user playing role Developers in current project with the least number of unresolved issues in all the Jira instance assigned.
leastBusyUserInRole(string projectRoleName, string projectKey)

STRING

Equivalent to the previous function but with extra argument projectKey for selecting the project argument projectRoleName refers to.
Example: leastBusyUserInRole("Developers", "CRM") returns STRING of the user playing role Developers in project with key CRM with the least number of unresolved issues in all the Jira instance assigned.

leastBusyUserInRole(string projectRoleName, string projectKey, string jqlQuery)

STRING

Equivalent to the previous function but with extra argument jqlQuery, used for restricting the issues to be considered to pick the least busy user as a STRING.

Example

leastBusyUserInRole("Developers", %{...projectKey}, "project = " + %{...projectKey}) returns the user playing role Developers in current project, with the least number of unresolved issues in current project assigned.


nextUserInGroup(string groupName, string queueName)

STRING

Returns the STRING name of the next active user in group with name groupName, for a round-robin queue with name queueName.

The string queueName is an arbitrary name. The queue is automatically created the first time a queue is used in a function call. Each time the function is called on the same pair of arguments (group, queue) , a different user in the group is returned. The queue can be used in different transitions of the same or different workflows within the same Jira instance. null is returned if group is empty.

Example

nextUserInGroup("jira-developers", "code-review-queue") returns the username of the next user in group jira-developers for round-robin queue code-review-queue. Each time the function is called with the same pair of arguments, a different username is returned.

On this page