Jira automation to block transition to done

Emerson Silva October 7, 2024

Hello everyone! I need help creating an automation in Jira that won't let me change a task to Done while there are issues linked to it set to "is blocked by".

2 answers

1 vote
Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

Hi Emerson,

While you might be able to get something to work for this using an automation, I'm not sure an automation is the best task at least not for the actual preventing of the transition. An automation happens after a trigger (or by a schedule, but that's not relevant here), so it would have to occur after a user already thinks its happened, walking an issue backwards from where it went, which can be confusing to the user and could have other complications depending on your workflow.

I would recommend the approach of using a workflow validation on the transition(s) that go to done if possible. This will prevent the transition from even happening so the users aren't confused.

The only problem, is that natively I'm not sure there's a way to identify that the "is blocked by" - at least not directly. Some kind of scripted field would be ideal if you have ScriptRunner or something like that on your instance, if not we may be able to use some automations to update a boolean/checkbox field to use for the validation. Of course, these may use your monthly automation allotment if they are global, but you could create a checkbox field to update with an automation every time the ticket is updated or closed so be mindful.

Let's assume you don't have a means of scripting. You would do something like this

 

  1. Create a custom checkbox field
  2. Create an Automation to flag an issue block. This runs on the blocking issue.
    1. Trigger = Issue linked for type: block
    2. Branch: Linked issues of type blocks
    3. Edit issue field for the new checkbox to be true (will have to use the advanced json section to update)
  3. Create and automation to remove issue block. This runs on the issue that's transitioning.
    1. When: Issue transitioned to Done
    2. IF: Linked issues match JQL (you. may need to edit jql to match what you define as "done", but I've used "resolution = Done"
    3. Then: Edit issue fields (use JSON to update the custom field to false).
  4. Use a validator on the workflow that references the custom checkbox field to determine if this can transition.

Screenshot 2024-10-07 at 12.02.58 PM.pngScreenshot 2024-10-07 at 12.09.28 PM.png

Emerson Silva October 7, 2024

I understand your idea and I will test it here to see if it works.

Thank you very much!

Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

No problem @Emerson Silva , I haven't tested fully so might need some tweaking but the basic idea is there.

1 vote
Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 7, 2024

Hi @Emerson Silva 

What you mentioned is not feasible with Jira Automation, but instead, you can use the Block parent issue workflow based on a sub-task status in your Workflow condition.

 

I hope this helps!

Best regards

Sam

Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

This will work in some scenarios, but only if the issues exist in a hierarchy. If there are issues that are lateral, or in different projects being worked on by different teams, etc, this may not work. 

Samuel Gatica _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 7, 2024

You're right, @Ryan M  For some reason, my mind played a trick on me and I read "subtasks," which isn't the case. Thanks!

Like Ryan M likes this
Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

Haha, well, they didn't give any specifics on the blockers so they could potentially all be subtasks, and if so, this way is much simpler!

Emerson Silva October 7, 2024

Hello everyone, in fact it would not only be for sub-tasks but also for other types of issues. In my context a task or user story that blocked a other task, for example. In this context I cannot, or I have not found a way to do it via workflow.

Suggest an answer

Log in or Sign up to answer