- Created by Daniel Barrow , last modified on Sept 20, 2023
-
Mentions
-
0 Associations
You are viewing an old version of this content. View the current version.
Compare with Current View Version History
« Previous Version 2 Current »
This post-function will assign an issue based on specified logic; you can use powerful filters and conditions to assign the current issue or issue(s) related to the current issue.
When you add this post-function to a transition and the transition is triggered, the add-on checks the Select user field for the user or role to use for assignment, and the Assignment Behavior setting to verify that the post-function’s assignment should be utilized. The post-function will then update the Assignee of the Target Issue appropriately. Additional configurations are available to more tightly control when the post-function will execute.
Please note: This post-function replaces the Assign to role member and Assign to last role member post-functions. These post-functions will not be removed at this time, but should not be used in any new extensions. Any workflows that use the deprecated extensions should be updated to use this post-function instead.
To add a post-function:
Log into your Jira Server instance as an Administrator.
Click on the Administration icon ⚙️ in the upper right corner.
Select Issues.
In the left-hand panel, click Workflows.
Click Edit for the workflow to be edited.
Edit the Transition:
When viewing the Workflow in Diagram view, select the Transition and click the Post Functions link. Click Add post function at the top of the list of existing post functions.
When viewing the Workflow in Text view, click the name of the Transition then select the Post Functions tab. Click Add post function at the top of the list of existing post functions.
Configure the post-function
Follow the steps above to add a post-function to a Transition.
From the list of post-functions, select Assign issue.
Click Add.
The Assign Issue page will open (Figure 1, right). Configure the post-function as needed, setting the options for user to assign, the assignment behavior, and additional options as necessary. See below for details on each of the configurations.
Click Add.
Note that you need to publish the workflow for the new post-function to take effect.
Select User
The Select user options set the logic to utilize to determine which user should be assigned the issue. The options are:
Select user - Select the user (or a role to which the user belongs) who will be assigned the issue. The options are:
Current user - The user who triggered the transition.
Reporter - The user value of the Reporter field for the issue.
Project Lead - The project lead for the project to which the issue belongs.
Default assignee for project - The user set as the default assignee for the project to which the issue belongs.
User who last commented
By username - Manually select a specific user (see User field, below).
Component lead - The user set as the lead for the selected Component (see Component field, below).
User from user object field - The user value from the selected field (see Field field, below).
Last role member - The previous role member who was assigned this issue.
Role member - Select the Role to which the user belongs as well as the Multiple user options to determine which specific user should be assigned (see Role and Multiple user options, below).
User returned from script - Enter a Groovy script that returns the user value for the assignee.
User - Only visible when Select user is set to ‘By username’. Enter the name of the user to whom the issue should be assigned.
Component - Only visible when Select user is set to ‘Component lead’. Select the required Component.
Field - Only visible when Select user is set to ‘User from user object field’. Select the required user object field.
Role - Only visible when Select user is set to ‘Last role member’ or ‘Role member’. Select the required role to which the user belongs.
Multiple user options - Only visible when Select user is set to an option that may return multiple users, such as ‘User from user object field’, ‘Role member’, and ‘User returned from script’. When a specific role is selected for assignment, that role may have multiple users assigned to it; the options sets which user within that set will be assigned to the issue. The options are:
Assign to the first matching user in alphabet order - The first user in alphabetical order, by display name. Please note: this is case sensitive.
Round-robin assignment - Only visible when Select user is set to ‘Role member’. For each project, JMWE stores a list of users who have been assigned any issue by any Assign issue post-function that is configured to use a round-robin assignment. The Assign issue post-function will cycle through that list and assign the issue to the next user in the round.
Assign to the least busy matching user - The user who has the least number of assigned tickets without resolution.
Assign to a randomly selected user
Specify the user with a custom script
Assignment script - Enter a Groovy expression that will return a user value.
Use values from the transitioned issue - Only visible when Select user and Which issue(s) are set in specific combinations. See Note, below. Use the Assignee value from the issue that triggered the post-function; otherwise, the post-function will use the Assignee value from the target issue.
Throw an exception if no user matches the specified criteria - Check this option to cause the extension to throw an error if no user is determined with the configured behavior.
Note: The option ‘Use values from the transitioned issue’ is only available under specific configurations:
The Which issue(s) field is configured to reference an issue that is NOT ‘Current issue’; in this context, ‘Current issue’ is the issue undergoing the transition and is the issue which triggered the post-function, and
The Select user field is configured to reference a user value that can vary between the transitioning issue and the Target issue(s). This includes the following values for Select user:
Reporter
User who last commented
User from the user object field
Last role member
For example, in your post-function you set Select user to ‘Reporter’ and Which issue(s) to ‘Parent issue of the current sub-task’. In this configuration, the post-function has two possible Reporter fields it could use to look up the correct user value - the issue being transitioned, or the Parent issue of the issue being transitioned. If the value for Reporter is different between those issues, the ‘Use values from the transitioned issue’ determines which of the two will be utilized.
Alternately, when the Target issue is the Current issue (the issue being transitioned), there is only one possible value for Reporter. Likewise, when using any of the other Select user values, there is only one possible user value (e.g. there is only one Project Lead, one Default Assignee for the project, or when using ‘Role member’ only one user that is returned from its specific configuration).
Assignment behavior
The Assignment behavior field determines whether or not the post-function will execute. If the behavior condition returns false, the post-function will not execute and the assignment of the issue will not be changed.
The options are:
Always - The post-function will always execute and assign the issue as configured.
If transition user value is “Automatic” - If the issue assignment is set to “Automatic” in the creation screen, or in a transition screen, the post-function will execute and assign the issue as configured.
If the transition user value is not changed - If the issue assignment has not been changed in the transition screen and it is not set to “Automatic”, the post-function will execute and assign the issue as configured.
If transition user value is NOT a member of the selected role - Only visible when Select user is set to ‘Last role member’ or ‘Role member’. If the assigned user in the transition screen is not a member of the role selected in the Role field (see above), the post-function will execute and assign the issue as configured.
Target Issues
The Target Issues configuration set which issue will be updated by the post-function.
Which issue(s) - Select the issue type.
Current Issue - The issue that is being transitioned and triggering the post-function.
Issue/Subtask
Sub-tasks of the current issue - Updates will be made to all sub-tasks of the current issue.
Parent issue of the current sub-task - Updates will be made only to the parent of the current issue (if any).
Epic/Story
Issues that belong to the current Epic - Updates will be made to all issues that belong to the current Epic.
Epic of the current issue - Updates will be made only to the Epic of the current issue (if any).
Portfolio Parent/Child
Child issues of the current issue in the Portfolio hierarchy - All child issues will be updated.
Parent issue of the current issue in the Portfolio hierarchy - Only the parent issue will be updated.
Issue links
Issues linked to the current issue through any link type
Issues linked to the current issue through the following link type
JQL / Groovy
Issues returned by the following Groovy script
Issues returned by the following JQL search
Issue Link - Only available when Which issue(s), above, is set to Issues linked to the current issue through the following link type. Select the required link type between the current issue and the issue to be updated.
Groovy script - Only available when Which issue(s), above, is set to Issues returned by the following Groovy script. Enter a Groovy script that returns the ID values for the issue or issues to be updated. See Customizing further with Groovy scripts for more information on Groovy scripting.
JQL expression - Only available when Which issue(s), above, is set to Issues returned by the following JQL search. Enter a JQL expression that returns the ID values for the issue or issues to be updated. See Using JQL in JMWE for more information on JQL.
Error Handling
Make transition fail when an error occurs in this post-function - Select this option to make the transition fail when an error occurs while running the post-function. An error message is displayed to the user showing the transition failure.
By default Error handling is turned off. When it is turned off, all errors (Java Exceptions) raised by this post-function, including those raised by custom Groovy scripts, will be logged in the JIRA log file. However, they will not be reported to the user and will not prevent the transition from completing.
When designing new workflows or troubleshooting them, it may more convenient to be notified immediately of any such error during the execution of the transition. For example, on production Jira instances you might want to show errors only for the post-function(s) being created or updated, in order to avoid disrupting other workflows. To make errors raised by the current post-function prevent the transition from completing and show the error in the browser, select Make transition fail when an error occurs in this post-function.
When the Error handling option is selected on a specific extension, it overrides the configuration on the JMWE configuration page.
If you want to show all errors - to either All Administrators or All Users - configure the option globally on the JMWE configuration page. For example, on development and staging instances, you can activate error reporting for all JMWE post-functions so as to display all the errors (it is recommended to do so); on production instances you may want to activate error reporting only for administrators so that they can be made aware of configuration errors.
Conditional Execution
In addition to the Assignment behavior settings, it is possible to configure the post-function to execute (or not execute) only in specific circumstances. The Condition execution options set these behaviors.
The options are:
Only if condition is true - Check this option to execute the post-function based on the result of a groovy expression. See Conditional execution/validation using a Groovy expression for more information.
Condition - Enter a Groovy expression that evaluates to
true
orfalse
(or truthiness/falseness).
Skip this post-function if another JMWE Assign Issue post-function in this transition has set an assignee - Check this option to bypass the post-function if another earlier Assign Issue post-function has already set an assignment successfully.
You are viewing the documentation for Jira Data Center/Server.
On This Page

- No labels