Create a Sub-task
Use this listener to create a new sub-task when the chosen event fires, or reopen a matching sub-task. This listener can be used multiple times to trigger the creation/reopening of several sub-tasks. You may want to:
- Create a sub-task depending on the value selected in a select field.
- Reopen a matching sub-task when a parent issue is commented on.
For example, I have a task that deals with multiple components of a business process. I want to auto create a sub-task whenever someone adds a component to the Tasks Components field so that I can automatically break down my task into component specific sub-tasks.
- From ScriptRunner, navigate to the Listeners tab and select Create Listener > Create a sub-task.
- Enter a description of the listener in Name.
- Define which project(s) the listener should be Applied to.
You can either check Global to apply the listener to all projects or check Select projects(s) and define the projects you want to assign the listener to. - Select the Events on which the listener fires.
For example, to create sub-tasks depending on the changes to a field, choose the Issue Updated event. Optionally, select Show snippets to display a list of example conditions that you can use to control when your listener runs. For example, you can set a condition which evaluates whether or not the issue priority field has changed. The listener only runs if the condition evaluates to true.
- Select the Target Issue Type. This is the Issue type the sub-task will be set to. This issue type must be valid for the current project.
- Optionally, enter a Sub-task Summary.
- Choose which Fields to copy to the sub-task. If you select Custom an additional field displays where you can specify the fields you want to copy.
- In the As User field, there is the possibility to select a user. The sub-task is created on their behalf, making the selected user the Creator and Reporter of the new sub-task. If empty, the current user is assigned.
- You can use the Additional issue actions field to customize the newly cloned issue. For example, you can set the sub-task summary to match the value selected from the select-list.
- Optionally, set a Sub-task Action. This action is only applied if a matching sub-task already exists.
- Select Add.