Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Automation: How to make story status change by completing story's subtasks

Jonathan Chatfield May 2, 2024

Hello,

 

I am wanting to have an automation that can change the status of a story at certain percentage threshold of changing the status of story's subtasks to done. 

Ex: Story is called "Testing interface" and the current beginning status is To Do.

Then The story will have 10 subtasks: HIM, JIRA, POWERBI, etc. I want a formula to be exceeding 1% of changing the subtask status to Done, then will change the status to In Progress  for the Story.

Then another formula that at 50% completed of the subtasks of the story will change the story's status to Testing Server. 

Then a last formula that at 100% complete of the subtasks of the story will change the story's status to Done.

How do I accomplish this using Jira Automation?

 

Thank you,

2 answers

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
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.
May 3, 2024

Hello @Jonathan Chatfield 

Welcome to the community.

You havent mentioned if you are in Cloud or DC. If you have lookupIssues, its a lengthy but straight forward rule to implement. If you dont have lookupIssues, let us know so we can suggest alternatives.

Assuming you have lookupIssues, try to implement below steps to begin with:

  • Trigger = Issue Transitioned to Done
  • If Condition = Issue type = Sub-task
  • lookupIssues => parent = {{issue.parent}}
  • create Variable => (allSubtaskcount) = {{lookupIssues.size}}
  • lookupIssues => parent = {{issue.parent}} and status = Done
  • create Variable => (doneSubtaskcount) = {{lookupIssues.size}}
  • Log statement => {{#=}}ABS({{donesubtasks}} / {{allsubtasks}} *100){{/}}

If you can get upto here, next is a series of If Conditions & Branch steps.

So try to get started with the rule, refer to screenshot and share screenshot of your rule / audit log at least until above steps and we can proceed further to do If Condition/Branch evaluation. 

image.png

Jonathan Chatfield May 3, 2024

Hello Kalyan,

Thank you for responding back to me so quickly! I am really enjoying Jira and wanting to have a automating way of helping the team out. I am not seeing a lookup issue button on the action's selections. Can you tell me if I am missing it? I love having both of your rules in my engine list so I will be building both just in case for the future! I do really appreciate the help and guidance!

Jira.jpg

Kalyan Sattaluri
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.
May 3, 2024

Hello @Jonathan Chatfield 

So, looks like you dont have lookupIssues. Which is fine. I am going to list you alternative steps. Can you replicate them and run the rule by transitioning a sub-task and sharing the audit log.

  • Trigger = Issue Transitioned to Done
  • If Condition = Issue type = Sub-task
  • Log Statement = {{issue.parent.subtasks.size}}
  • Log Statement = {{#=}} 0{{#issue.parent.subtasks}}{{#if(equals(status.name,"Done"))}} +1 {{/}}{{/}}{{/}}
  • Log Statement = {{#=}}{{#=}}0{{#issue.parent.subtasks}}{{#if(equals(status.name,"Done"))}} +1 {{/}}{{/}}{{/}} / {{issue.parent.subtasks.size}} *100{{/}}

As mentioned, implement the rule like I have in below and share screenshot with audit log. Once done, we can continue with the If/Branch logic I mentioned.

image.png

 

Like Jonathan Chatfield likes this
Jonathan Chatfield May 3, 2024

Test Kalyan.jpg
I am on config change status still. I have made a change to a subtask status from done to To Do and back to Done. I do not see like yours where it says the status on the rule is success.

Kalyan Sattaluri
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.
May 3, 2024

Are you transitioning a sub-task to "done" for one which is in the same project right? LOL

Jonathan Chatfield May 3, 2024

Hahahah now I am questioning everything! =P
The word transition in jira is when you change the status correct or is transition something totally different?
I have confirmed that this rule is on the same project since it shows the changes that I made clicking on the project itself

Jonathan Chatfield May 3, 2024

Trans.jpg
I looked up transition online and we are on the test project to make sure everything works correctly as this is just a skeleton of what the main project looks like. So I do have it on the right project, here is the issuetypes and the transitions for them. Is there something wrong with this setup?

Kalyan Sattaluri
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.
May 4, 2024

Hello @Jonathan Chatfield 

Yes, transition in this context is to move an issue to Done.

I am not sure why your rule is not triggering.

Lets try a different thing just to confirm rule is going to get triggered.

Change your trigger from "Issue Transitioned" to "Scheduled Trigger" and in the JQL section on same screen, give a sub-task key which we will use to test. Like I have below screenshot. Notice the highlighted section, make yours like I have..

So change trigger, go to that sub-task and change it from In Progress to Done  and share the audit log.

image.png

Jonathan Chatfield May 4, 2024

Rule ran.jpgScreenshot1.jpg
@Kalyan Sattaluri I have did what you asked and highlighted shows that it is pulling from that subtask and added the logs, I had changed the status twice from in progress back to done and ran it to show the same function happening.

Your screenshot had the previous rule running that I do not have lookup functionality. I just wanted to remind you since we got so many screenshots haha! I do really appreciate you helping me and sticking with this. This is very kind of you!

 

Kalyan Sattaluri
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.
May 4, 2024

Is HOC-174 a sub-task? Cause from the audit log it does not look like it.

Please replace it with a sub-task and transition that sub-task.

Jonathan Chatfield May 4, 2024

Line.jpg

176.jpg

It is a sub-task, I will change it to Cher hoc-176 and here is the log. I have changed the key to Cher then published it then went to hoc 176 cher then changed it to in progress to done then I pressed run rule button. I want to explain the steps I did to see if I did anything wrong! =D

Kalyan Sattaluri
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.
May 4, 2024

Hmm, something's strange. One last thing, can you, before the If condition, add another log statement to check if HOC-176 is called sub-task or something different in your set up?

So, log {{issue.issuetype.name}} like I have in my screenshot, right after the trigger, run the rule and share screenshot..

image.png

Like Bill Sheboy likes this
Jonathan Chatfield May 6, 2024

Hey @Kalyan Sattaluri !
So I got a screenshot with a success but tell me if it looks good. I see a issue condition that does not recognize hoc-176. I hope we are making progress! =D

success.jpg

Kalyan Sattaluri
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.
May 6, 2024

Hello @Jonathan Chatfield 

I honestly am not sure why your "If condition" is not passing the check. 

You may need to check with someone in your company on why thats happening as what I was sharing is expected behavior.

Either you are in a really old version of automation with bugs in software or there is something wrong with how your issue types are configured. 

So please try to check in with someone in your company and share them this rule and ask why we cant get past the first If check.

Jonathan Chatfield May 6, 2024

Hey @Kalyan Sattaluri

 

I knew your logic had to be correct, so I relooked at my if: issue condition and there are two Issue types selections from the dropdown menu to choose so I chose the other one and got an actually log it looks like! What else is there? Success1.jpg

Bill Sheboy
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.
May 6, 2024

Hi @Jonathan Chatfield 

There is a typo in one of your log write smart values: subtask should be subtasks:

parent subtask count: {{issue.parent.subtasks.size}}

I recommend adding prefix text to log entries like this to confirm which value is logged.

Kind regards,
Bill

Like Stefan Salzl likes this
Jonathan Chatfield May 6, 2024

Hello @Bill Sheboy

 

Thank you for spotting that! I looked into the log and see where that section didn't have information! That is good to know for future references for checking!!

Like Bill Sheboy likes this
Jonathan Chatfield May 6, 2024

successor.jpg

Hey @Kalyan Sattaluri

After seeing that mistake, I went back to the code you previously sent and it seems to be working. I look forward to hearing your next steps to make this happen. I really appreciate all your help and this guidance is helping me understand what I need to type in these fields for the future! =D 

Like Stefan Salzl likes this
Kalyan Sattaluri
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.
May 6, 2024

Hello @Jonathan Chatfield 

Good to hear you got past the first step. 

Just FYI & I should have explained it earlier itself- the last log statement  we did was to calculate the % of done. That is:

{{#=}}{{#=}}0{{#issue.parent.subtasks}}{{#if(equals(status.name,"Done"))}} +1 {{/}}{{/}}{{/}} / {{issue.parent.subtasks.size}} *100{{/}}

We will be using the above syntax as part of our check.. Hope you have tested with various combinations of sub-tasks in different states so you can check the % done calculations. If not, please do at this point.

Also, at this time, change the trigger back to "Issue Transitioned" as we first had it..

 

-----------------------------------------------------------------------------------------

Now, the next steps, its just a series of If/Else and branch statement.

I am going to list steps how your rule should continue, take a look at below set up, and modify according to the statuses you want...

So, After your last log statement, you will do:

Add Condition -> If/Else Block:

  • -> Add Conditions -> Advanced Compare condition, 
    • {{issue.parent.status.name}}
    • "CONTAINS"
    • To Do,
  • &&
  • -> Add Conditions -> Advanced Compare condition, 
    • {{#=}}{{#=}}0{{#issue.parent.subtasks}}{{#if(equals(status.name,"Done"))}} +1 {{/}}{{/}}{{/}} / {{issue.parent.subtasks.size}} *100{{/}}
    • Less Than
    • 50
  • Branch -> For Parent 
    • Transition Issue -> In Progress

 

NOTE: the first check of "To Do" applies only for first case, for the rest of the else statements you dont need the status check . You can just check % done and transition.

MORE IMPORTANT NOTE: If you have transition workflow restrictions on story, that is, unless "Acceptance criteria" is filled in, you cannot go to "in progress" or similar, your rule will fail.. so you need to handle that after branch but before you transition the issue by doing Edit Issue and filling in the fields or whatever is needed to satisfy the transition...

I have included a first condition of the screenshot, you just need to include based on your requirement. 

So, given first step is done, From here on, you just keep adding additional else clause and "additional conditions" for next series of checks you want to do. Should be straight forward.

So try to implement the same, play around with your requirements and make sure your If conditions are tight. That is, earlier we gave % done is less than 50, and we made it "in progress", next, give a specific range of % Done is greater than 50 and less than 75%, if so, transition to "testing server", equal to 100, transition to "Done"...

Its just a matter of testing all scenarios thoroughly. So try it and let us know. 

image.png

Jonathan Chatfield May 6, 2024

Test 1.jpgTest.jpg

Hey @Kalyan Sattaluri 

I feel like I typed everything like you did but there is something wrong with my If since I see the If block is saying did not match condition. Here is the code that I wrote:

{{issue.parent.status.name}}

Contains

To Do

{{#=}}{{#=}}0{{#issue.parent.subtasks}}{{#if(equals(status.name,"Done"))}} +1 {{/}}{{/}}{{/}} / {{issue.parent.subtasks.size}} *100{{/}}

Less than 

50

Am I doing something wrong? Also I am attaching the main story screenshot as well just to show that I did 25%iverview.jpg

Kalyan Sattaluri
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.
May 6, 2024

Your HOC-166 story initial state is "BACKLOG".

 so change first If condition to:

  • {{issue.parent.status.name}}
    Contains
    BACKLOG

Earlier it was To Do, because thats what I have as my initial state of story. So please take care of your status's names.

Jonathan Chatfield May 7, 2024

Awesome, It works! Thank you for all this help @Kalyan Sattaluri
 I had to type Backlog and boom it all worked! I did a 50 percent In Progress and a 100 percent transition to Done status for the story!

Now since the story automatically transitions because the trigger is me changing the subtasks, how can I change the same process but at a epic level when a certain amount of stories are done?
I tried to run it but it is not going so well haha, but I am glad to be learning from this hands on way so I really do appreciate all this help!

Kalyan Sattaluri
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.
May 7, 2024

Hello @Jonathan Chatfield 

Great to hear. *high fives*

Regarding doing same thing with Epic/Stories, unfortunately its not possible the same way.

Stories/Sub-tasks are tightly coupled, in that sub-tasks cannot exist with out stories.. so we could do that here..  but Epic/Stories are not the same. Stories can exist without Epic, so we cannot use the same format.

To solve Epic/Story problem, and because you dont have lookupIssues, we need to rely on making a REST API calls to get that done.

If you havent set up one before, definitely an advanced topic, maybe start a new post with that requirement so discussion can stay focussed.

Now regarding this thread, if you feel the rule is working properly, please accept solution so the discussion benefits folks in the future. Thanks!

Like Stefan Salzl likes this
Jonathan Chatfield May 7, 2024

Awesome! I will start a new topic and try to get that going! Thank you for all this help =D

Like Stefan Salzl likes this
Kalyan Sattaluri
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.
May 7, 2024

Awesome, as mentioned, please dont forget to accept the answer so its marked as complete. Thanks!

0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 3, 2024

Hi @Jonathan Chatfield - welcome to the community,

I suggest the following:

whenever a subtask is set to done the rule should run and check for all subtasks in the story. This will be done with a lookupIssues (collect all done subtasks within the same parent).

then going through the options with if-else conditions calculating the percentage of done subtasks and transitioning the parent via parent-branch. 

see the screenshot below (I just took the status I have in my system - need to be changed according your requirements):

image.pngimage.pngimage.png

 

Hope this was helpful. Let me know if you have any further questions.

Best
Stefan

Jonathan Chatfield May 3, 2024

Hello Stefan,

Thank you for responding back to me so quickly! I am really enjoying Jira and wanting to have a automating way of helping the team out. I am not seeing a lookup issue button on the action's selections. Can you tell me if I am missing it? I love having both of your rules in my engine list so I will be building both just in case for the future! I do really appreciate the help and guidance!

Jira.jpg

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 6, 2024

Hi @Jonathan Chatfield 

Could you please show a screenshot of your rule details? Furthermore: which versions are you running (Jira as well as automation).

Could you please also try setting up a complete new rule with just the trigger, the first condition and the first audit log action? Sometimes it happens that up glitchy after editing or shifting components. Let‘s try if the same logic works in a newly created rule.

Another point that could be checked is the server log. If you arent able to acccess theog files ask your admin. The should be able to access.

Best
Stefan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events