Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Check, if the last sub-task is in status "ACCEPTED", before transit the parent issue

Lukas
Contributor
October 7, 2022 edited

So I try to explain what is the situation: I have an issue, where you need an approval to go further in workflow (transit status). Approval is a subtask. To transit the issue to next status (Risk Treatment) should the last approval subtask must be in status "APPROVED", That means, you might have many approval subtasks, for example you have 2 approval subtasks and the first one is in status "rejected" then the second one thus the last on is in status "approved". In this case you are able to transit the issue to next status (Risk treatment).

If you have just one approval task, which is rejected, you should'nt be able to transit the parent issue, until you create a new approval subtask, which should be then approved. 

Is it possible to solve this problem with Jira Automation?

positive approval needed.PNG

1 answer

1 accepted

2 votes
Answer accepted
Mark Segall
Community Champion
October 7, 2022

Hi @Lukas - This is possible, but not with automation alone.  Here's what you need:

  • A mechanism to indicate on the parent issue that sub-tasks are not yet ready.  You could use the flag field, a component, label, or custom field
  • A validator on the appropriate parent workflow transition that when "flagged" (whatever mechanism you chose above) the parent cannot transition
  • Automation rule that triggers off of the sub-task and branches into the parent to flag/unflag accordingly
Lukas
Contributor
October 7, 2022

@Mark SegallI have to say my project is company-managed business project  in Jira Cloud and not software project. So that means, the use of flag field or component ist pretty limited. What can you recommend in tis case?

Mark Segall
Community Champion
October 7, 2022

Are you a Jira Admin on the instance?  That will be critical because you'll need those rights to set the validation rule.

I haven't tried myself, but you may still be able to use flagged.  JSM projects don't use the flag feature either, but I'm able to set it with automation and have done so for this exact purpose in the past (actually cements it as a good option because users can't inadvertently muck with it).  If it's truly unavailable (even to automation), I'd recommend some type of custom field that is not on the screen config, but available to the field configuration scheme - making it hidden to users.

Lukas
Contributor
October 7, 2022

@Mark Segallyes I got admin rights there. So can you please explain it, what I have to do exactly? I've never used components by the way. 

Mark Segall
Community Champion
October 7, 2022 edited

Sure... Here are more detailed steps:

First, we'll add the flagged validator on your workflow...

  1. Navigate to your workflow from project settings, and click Edit (Switch to Diagram view if not already on it)
  2. Select the transition that goes to RISK TREATMENT
  3. Select validators in the pop-up
  4. Click ADD VALIDATOR
  5. Regular Expression Check
  6. Select Flagged
  7. ^.{0}$

Next we'll set up a couple automation rules:

Rule #1: Flag Parent when Sub-Task is created

We want the flag to be set as soon as a sub-task exists:

  • TRIGGER: Issue Created
  • BRANCH (Parent)
    • ACTION: Edit Issue (Select the Flagged field)
      • Select "Impediment"

Rule #2: Unflag Parent when Sub-Task reaches Approved

This will only unflag the parent when the last sub-task has transitioned to APPROVED status

  • TRIGGER: Issue Transitioned
    • To: APPROVED
  • BRANCH (Parent) 
    • CONDITION: Related Issues condition
      This condition will make sure that there aren't any other sub-tasks in some type of To Do/In Progress state
      • Sub-Tasks
      • All Match specified JQL
      • statusCategory = Done
    • ACTION: Edit Issue (Select the Flagged field)
      • Leave blank to clear it
Like • Lukas likes this
Lukas
Contributor
October 7, 2022

@Mark Segall 

@Mark Segallsomehow that didn't worked. Should I add the field "flagged" to the Risk Screen? Here are the screenshots from them, what I've been set so far:

Transition to RISK TREATMENT.PNG

Rule 1.PNG

Rule 2.PNG

This approval subtask will be created automatically, when specific conditions are are met, (likewise risk score is higher than 16 etc.) but this doesn't matter, I think.

Rule status is for both rules CONFIG CHANGE, so these rules doesn't executed, I assume.

Mark Segall
Community Champion
October 7, 2022

A couple things...

  1. Since the sub-task is created by way of automation, you'll need to check the box under Rule Details
    1. Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule.
  2. You should not need to add flagged to the screen, but it should be available in the field configuration scheme
Like • Lukas likes this
Lukas
Contributor
October 7, 2022

@Mark SegallNow I'm one step ahed, so parent issue get flagged now. But I'm still able to transit the issue, even approval subtask is rejected as you can see at the screenshot below. What could be the reason?

Transition to RISK TREATMENT.PNG

Mark Segall
Community Champion
October 7, 2022

You know what...  I had to use a validator in my past and your use case would need a condition.  With a validator, the option is still there, but it will error on you if you try to select it. Whereas a condition will hide the status altogether.

So, let's do this:

  1. Remove the validator
  2. Add a condition
    1. Value Field
      1. Flagged != Impediment

Sorry about that.

Like • 2 people like this
Lukas
Contributor
October 7, 2022

@Mark SegallNow that thing works, how it should be :) Thank you man! I appreciate that a lot!

Like • Mark Segall likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events