Automatically Transition Jira Issues with JMWE

As a Jira administrator, I frequently see this problem: child issues are closed but nobody remembered to close the parent issue. Users have already moved on to the next thing and the parent issue sits in its incorrect status forever. Or maybe it’s the opposite: the Epic is closed, but its Stories, Bugs, and Tasks were forgotten.

When issue status does not reflect reality, reporting is a nightmare. All completed or unneeded issues should be transitioned to their final status. Why not take this step off your user’s “to do” list and automate it? It’s easy to automatically transition issues with Innovalog’s Jira Misc Workflow Extensions (JMWE) app.

Use Case

When all child issues are closed, automatically transition the parent so users don’t need to do it manually. Example: When all Sub-tasks are transitioned to the “Closed” status, automatically transition the Task issue to the “Closed” status.

Requirements

You’ll need the following:

  • Access: Jira application administrator permissions (to install the app) and the ability to edit workflows
  • Environment: Jira Server, Jira Data Center, or Jira Cloud
  • Install: Install the JMWE app from the “Find new apps” page in your Jira instance. Apply a free trial or paid license on the “Manage apps” page.

We’ll use the following app features:

We’ll use the following standard features:

  • Condition – Sub-Task Blocking Condition

Set Up

Set up or create the following:

  • Issue Types: A “Standard” issue type (Example: Task) and a “Sub-Task” issue type (Example: Sub-task). These are default Jira issue types; they likely already exist.
  • Workflow: Create one simple, 3 step workflow. Example: Open > In Progress > Closed
  • Issues: Create one “Task” issue and two “Sub-task” issues

Implementation

Here’s how to do it:

  • Edit the workflow
  • In diagram mode, create a new global transition
    • Click “Add transition”
    • In the “From status” field, select “Any status”
    • In the “To status” field, select “Closed”
    • In the “Name” field, enter “Close”
    • In the “Screen” field, select your standard “Resolve Issue Screen”

Add Transition Screen

Add Transition Screen in Diagram Mode

Here’s how the workflow looks, in Text mode, with the global “Close” transition.

Jira Task Workflow

All statuses have a global “Close” transition.

  • In the “Close” transition:
    • Add the “Transition parent issue (JMWE add-on)” post function
    • Configure three areas on the transition settings page: “Transition(s)”, “Transition screen”, and “Comment text”.
      • Under “Transition(s)”:
        • Click the “Transition Picker” button to select the correct transition. Alternatively, you can type the name of the transition (Example: “Close”) or enter its ID (Example: “31”).
          • Tip: I prefer to enter the transition’s ID as it’s less likely to change than its label.
        • Click the “Add” button to the right of the “Workflow name” field. See screenshot
      • Under “Transition screen”:
        • Scroll down to the “Transition screen” section
        • Select the “Resolution” field from the drop down menu
        • Click the “Add” button
        • This will automatically set the parent issue’s Resolution to the same Resolution selected when the last child issue was closed. See screenshot
      • Next to “Comment text”:
        • Use the “Comment text” field to enter a comment when issues are automatically closed.
          • Example comment: “This issue was automatically closed when all Sub-tasks reached the “Closed” status.” See screenshot
    • Click the last “Add” button at the bottom of the transition settings page
    • Move the new post function after the function called “Update change history for an issue and store the issue in the database.

Innovalog JMWE "Transition parent issue" Post Function

The “Transition parent issue” behavior is the forth post function in the “Close” transition.

  • Also in the “Close” transition:
    • Add a “Sub-Task Blocking Condition” and select the “Closed” status. This prevents the parent from transitioning until all child issues are closed.
      • Example behavior: All sub-tasks must have one of the following statuses to allow parent issue transitions:  Closed
    • If you want email notifications sent when the issue is automatically closed, go to the “Post Functions” tab and change “Fire a Generic Event event that can be processed by the listeners.” to “Fire a Issue Closed event that can be processed by the listeners.”

Finally, publish your workflow and assign it to the “Task” and “Sub-task” issue types in your Jira project.

Result

Test your work:

  • Transition one of your two Sub-task issues to its final “Closed” status
  • Refresh your parent Task and verify there was no status change, no comment, and no resolution added
  • Transition your second Sub-task issue to its final “Closed” status
  • Refresh your parent Task. The Task should automatically transition to its final “Closed” status with a resolution and comment added.
  • Bonus test: Create a Task issue with no Sub-tasks. Transition the Task to its final “Closed” status. Verify a transition screen is present to collect the resolution. Always make sure closed issues have resolutions!

Innovalog JMWE Result

The two Sub-task issues are in the “Closed” status. The parent Task issue was automatically transitioned to the “Closed” status, a resolution of “Done” was set, and a comment was added.

Q&A

Why did you create a global “Close” transition instead of a single transition?

I wanted to be able to transition the Task issue to the “Closed” status from any status. If users always transition Tasks to the “In Progress” status when they start work, you could create a single transition, in the “In Progress” status, instead.

Why did you add a transition screen to the “Close” transition?

For issues with no Sub-tasks, the user needs to select a resolution value. For issues with Sub-tasks, the parent issue’s resolution will automatically match the resolution of the last Sub-task closed.

How do I automatically close Epics?

Use the “Transition linked issues (JMWE add-on)” post function and the ”Linked Issues Status Condition (JMWE add-on)” condition instead.

It’s not working as expected. What should I do?

  • Make sure the “Transition parent issue” post function is positioned after the “Update change history…” behavior.
  • Verify the “Transition parent issue” post function is connected to the “Close” transition.
  • Verify the “Sub-Task Blocking Condition ” is present and the “Closed” status is selected.

Still having trouble? Check the Jira log file, turn on error handling on the Jira Misc Workflow Extensions Global Configuration page, review the JMWE documentation, review answered questions in the Atlassian Community, or raise an Innovalog support request.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events