Automatically create sub-tasks on 'Development' issues
Goal | Automatically create sub-tasks for new Development issues. |
---|---|
Scenario | You want to automatically create sub-tasks for specific non-Developer teams to ensure that new or updated features are reviewed by teams that are downstream of primary development. |
Components | Event-based Action: Issue created event, Create issue(s) post function, Set issue fields post function |
Baseline |
|
In these scenarios, some examples of useful related issues or sub-tasks are:
QA issues for testing and verification
Documentation tasks
“Review” tasks for Support teams, Marketing, or Project Management
Alternate Configurations
Your workflows may use different organization, or you may want to use different methods of designating Development issues.
Be sure to review the Alternate Configuration callouts below for suggestions on how to modify this configuration for your specific circumstances!
You are viewing the documentation for Jira Cloud.
Requirements
JIRA Administrator login
The issue types Story and Tasks are reserved for development use only
1. Create the Event-based Action
Log into your instance as an administrator.
Click on the Settings icon in the upper right corner.
Select Apps.
In the left-hand panel under JIRA MISC WORKFLOW EXTENSIONS, click Event-based actions and click Create new action in the upper right corner.
Give your Event-based action a name and, optionally, a description.
Under WHEN, make sure Select Event is selected. In the right-hand panel, select Issue Created (Figure 1, right).
Set the other options under WHEN as needed.
Under IF SCOPE:
Leave Projects set to Any.
Click Issue Types.
In the upper-right corner of the right panel, click Select Issue types.
Check the boxes for Story and Task (Point 1, Figure 2, right).
Click Add (Point 2, Figure 2, right).
Alternate Configuration
You may use Stories and Tasks for additional teams, so you don’t want to create related issues/sub-tasks for every Story and Task
<use custom issue types, labels to designate Development issues, or check User/Team assignment>
2. Add the Create issue(s) post function
Under THEN, click Select Post-functions.
In the right-hand panel, click Create issue(s) in the list of post functions. The Create issue(s) configuration screen will open.
Leave Project as Same as current issue.
For Issue type select Sub-task (Point 1, Figure 3, right).
Leave Parent issue and Link type as the default values.
For Summary select Custom value from script.
Under New value enter the following script (Point 2, Figure 3, right):
{{it}} for {{issue.fields.issuekey}} - {{issue.fields.summary}}
Expand the Advanced options section, then expand Actions after issue creation.
Check Create multiple issues.
Under Iterator, enter the following (Point 3, Figure 3, right) to create 2 sub-tasks (one for each value in the comma-separated list):
QA - Testing, Documentation - Updates
Click Save to save your post function configuration.
3. Add the Set issue fields post function
Under THEN, click Select Post-functions if it is not already selected.
Click Add Post-function in the upper-right corner of the right hand panel.
Select Set issue fields and click Add. The Set issue fields configuration screen will open.
We need to use Nunjucks to access the IDs of the issues created in Section 2, above. For Target issues select Issues returned by the following Nunjucks template.
In the script editor (Point 1, Figure 4, right), enter:
{{ context.newIssueKeys }}
Under Fields to update, click Add.
In the panel for the new field, select Description under Field.
Under New value (Point 2, Figure 4, right), enter the following:
This is a sub-task for issue {{ issue.fields.issuekey }}. Please review the main issue before proceeding.
Click Add in the field configuration panel (Point 3, Figure 4, right).
Click Save (Point 4, Figure 4, right).
Save and Test the Action
In the main Event-based Action editor, click Save to complete the configuration. To test the new action, create a new Story or Task and verify that JMWE has created two sub-tasks and has automatically set the correct Summary and Description values.