How do I update status of an issue that depends on other issues status?
Asked by Srdjan_Boskovic:

Hey Atlassian Community,

I'm new to Atlassian automation and still learning and I hope you can help me with a problem.

I have a project (Project X) which is used as inbox for multiple projects, ie. a request to Project X creates tickets/issues (of different types) in multiple other Projects.

Every ticket/issue is linked to the original Project X request/ticket as "depends on" outward dependency.

i.e. Project X, Issue 1 (X-1) creates:

- Project Y, Task 2 (Y-2)

- Project Z, bug-3 (Z-3)

- ...several other projects and issue types.

- all these are linked as following; X-1 depends on Y-2 and Z-3 (and others).

I want to be able to periodically inspect the status of Y-2 and Z-3 and move X-1 into a specific state based on their corresponding states, eg.

- if Y-2 OR Z-3 are IN PROGRESS then move X-1 to IN PROGRESS

- if Y-2 AND Z-3 are DONE then move X-1 to DONE

I DON'T want to have automation on all affected projects, since these are many and use different types of issues so maintainability will be horrible over time yet I need to do this automation on Project X level.

This is what I have right now:

- Timer Trigger with JQL query that check all issues in Project X that are in backlog. -\> so I get X-1 (and other Project X issues in that state).

- Branch off for every issue above and go through their corresponding linked issues and their status values. -\> I get Y-2 and Z-3 when I loop through X-1 linked issues.

- if one of these are in progress then DO SOMETHING to make sure trigger issue X-1 status is updated. -\> I get the status of Y-2 and Z-3 but need help with DO SOMETHING part.

When in the fork/loop I can see that Y-2 and Z-3 are linked to X-1 (using

issue.issuelinks.inwardIssue.key) but I don't know how to change X-1 status.

I tried to:

- set issue.issuelinks.inwardIssue.key.status value -\> but that's not how it works.

- create a smart variable in the main loop, eg. inProgress, and set it to false by default but then change the value in the inner loop to true in case of hit. -\> that's not how it works. The smart values are locked to the context they run in.

- find an article or someone trying to do something similar but my google-fu is failing me.

Any ideas/suggestions? Is there any another, simpler, way to do this?

Adding flow directly here as a reference:

![Screenshot 2024-08-29 at 13.35.22.png](https://community.atlassian.com/t5/image/serverpage/image-id/344540iD2097BEA4FA421FE/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 13.35.22.png")![Screenshot 2024-08-29 at 13.36.21.png](https://community.atlassian.com/t5/image/serverpage/image-id/344539iE92C1E03074CAF73/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 13.36.21.png")

(5mins is just for now. When done, this will run on hourly cadence. Also, note that in the inner-loop I set inProgress only once. This is to avoid next issue overriding the value if I already have a hit)

thanks in advance!

Also, another question:

- is there a simple way to debug jira automations? Right now I use email action to notify myself of the different states and values in the automation :( and yesterday I forgot to switch the automation off 4hrs and spammed myself with \~4000 emails since I set the timer to every 5min meanwhile writing the automation. There must be a better way to do this, or?


Answers:
author: Srdjan_Boskovic
body: I have solved this now thanks to the suggestion made by Walter Buggenhout (can't tag him and credit him for some reason) here: <https://community.atlassian.com/t5/Jira-questions/Change-status-when-resolution-is-done-in-another-issue-project/qaq-p/2253492>

But, I have to say I **LITERALLY H_8** it. :old_man_yelling_at_clouds:

It feels like I have to change the tires on the car in order to open the passenger window :(

*** ** * ** ***

**This is what I did to solve it:**

**Part 1:** Traverse through all linked issues and check their state. If "In Progress" (or similar), create a sub-task on the trigger issue and set some labels on it. This operation will trigger issue update event on the trigger issue. Here's the flow:

![Screenshot 2024-08-31 at 08.56.08.png](https://community.atlassian.com/t5/image/serverpage/image-id/344916i395F9848A557616F/image-size/large?v=v2&px=999 "Screenshot 2024-08-31 at 08.56.08.png")

**Part 2:** If issus has been updated and is in "Backlog" state and it has sub-task with specific labels (that were set in Part 1) then transition it to In Progress state and delete the sub-tasks that were created in Part 1. Here's the flow:

![Screenshot 2024-08-31 at 08.22.34.png](https://community.atlassian.com/t5/image/serverpage/image-id/344917i178BC70703FA8BB6/image-size/large?v=v2&px=999 "Screenshot 2024-08-31 at 08.22.34.png")

*** ** * ** ***

**This is how I THINK it should be solved instead:**

**Alternative 1:** Allow Set issue property action to operate on {{triggerIssue}}. This is currently not possible even though the automation doesn't give any errors or warnings when you try to do it. This is my preferred solution since it allows user to operate on ANY issue property for the trigger issue. Ie. powerfull stuff that would enable many other automations. The flow is here:

![Screenshot 2024-08-31 at 08.12.37.png](https://community.atlassian.com/t5/image/serverpage/image-id/344918i46359A6CBACD7BCF/image-size/large?v=v2&px=999 "Screenshot 2024-08-31 at 08.12.37.png")

**Alternative 2:** Allow Transition action to operate on the trigger issue. This would solve my problem but is limiting to only transitions so less preferred than Alternative 1. The flow is here:

![Screenshot 2024-08-31 at 08.13.22.png](https://community.atlassian.com/t5/image/serverpage/image-id/344919i89D3D2DBA7DEC4CC/image-size/large?v=v2&px=999 "Screenshot 2024-08-31 at 08.13.22.png")

*** ** * ** ***

**Can anyone suggest how I contact Atlassian Jira Automation folk to suggest these improvements?** I'm still new to this so I don't know what is "the way"?

Again, I'd like to avoid changing tires to get the passenger window down... :)

comments: author: Simon K?nig
body: Hi sorry I was away for a while. Good thing you solved it. And yes, that is very non-intuitive.

Suggestions can be reported here: [Automation Suggestions Atlassian Support.](https://jira.atlassian.com/projects/AUTO/issues/AUTO-1470?filter=allopenissues)

Just have a look at already given suggestions.

Regards


author: Srdjan_Boskovic
body: Any automation ninjas out there that can help out with this? Any other way I can solve this (and without adding automations on multiple projects)?


author: Simon K?nig
body: Hello and welcome.

I am not sure if I understand you correctly, but I'll try to help:

*Branch off for every issue above and go through their corresponding status value.*

If you branch off and iterate over multiple Issues, everything you do in that branch is done on the current Issue the automation is "looking up".

E.g.: If you branch over all Issues connected via a Link Type and if that (Connected)Issue is in a status, then you want to edit it. You need to do the following:

Branch -\> IF Status = "done" -\> Edit Issue.

This will edit the Issue that you branched off to, if in the status given and ++not++ the Issue you started with!

Maybe that's why *"issue.issuelinks.inwardIssue.key.status value"* didn't work. *"issue."*will reference the issue the automation is looking up, not the Issue you started the automation on.

Try to change the reference.

Maybe you could share a screenshot of your automation and maybe a small map off your project/linktype configuration so I (and others) will understand your specific problem in a better way.

Kind regards

comments: author: Simon K?nig
body: If you want to lookup multiple Status-Values, one you could try is to iterate over all Issues with a branch -\> Create a smartvalue, if they are in a status -\> then (outside the loop) edit the Issue you started on, given the smartvalues.

I don't know if this will work if a smartvalue is missing though.


author: Simon K?nig
body: To make my point clearer:

![Screenshot 2024-08-29 133654.PNG.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/344492i70503A2B30DFC48F/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 133654.PNG.jpg")

This rule will transition every Issue found under the query "status = "submitted" and NOT the Issue this rule would have been manually triggered on. I just tested it to validate that.


author: Srdjan_Boskovic
body: Thanks Simon,

Some comments back:

*** ** * ** ***

*" Branch off for every issue above and go through their corresponding status value.*

*If you branch off and iterate over multiple Issues, everything you do in that branch is done on the current Issue the automation is "looking up".*

*E.g.: If you branch over all Issues connected via a Link Type and if that (Connected)Issue is in a status, then you want to edit it. You need to do the following:*

*Branch -\> IF Status = "done" -\> Edit Issue.*

*This will edit the Issue that you branched off to, if in the status given and ++not++ the Issue you started with!"*

Yes, I understand that. That's what I tried to explain in my original text (but failed, it seems. Sorry).

*** ** * ** ***

*"Maybe that's why "issue.issuelinks.inwardIssue.key.status value" didn't work. "issue." will reference the issue the automation is looking up, not the Issue you started the automation on."*

So, **issue.issuelinks.inwardIssue.key** works! I get X-1 value which is correct. But setting the status of X-1 doesn't work by using **issue.issuelinks.inwardIssue.key.status**.

I still don't know enough about Jira custom fields but I suspect it is because the issue property structure is flat. ie. I need to set **issue.status** and can not set **issue.key.status** because it's not how the structure is defined.

*** ** * ** ***

*"Try to change the reference."*

How do I do that?

*** ** * ** ***

"Maybe you could share a screenshot of your automation and maybe a small map off your project/linktype configuration so I (and others) will understand your specific problem in a better way."

See attached screenshots below for reference. This was an attempt to use smart variables but then I realized (through my email logs :( ) that they are context/thread specific, ie. these are just two variables with the same name, one in the main loop and the other one in the nested one.

*![Screenshot 2024-08-29 at 13.35.22.png](https://community.atlassian.com/t5/image/serverpage/image-id/344494i1807AF38BB85F412/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 13.35.22.png")*

*![Screenshot 2024-08-29 at 13.36.21.png](https://community.atlassian.com/t5/image/serverpage/image-id/344493iAF7C1910C222EE30/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 13.36.21.png")*

(5mins is just for now. When done, this will run on hourly cadence. Also, note that in the inner-loop I set inProgress only once. This is to avoid next issue overriding the value if I already have a hit)

*** ** * ** ***

*"If you want to lookup multiple Status-Values, one you could try is to iterate over all Issues with a branch -\> Create a smartvalue, if they are in a status -\> then (outside the loop) edit the Issue you started on, given the smartvalues.*

*I don't know if this will work if a smartvalue is missing though."*

Not sure if I understand clearly what you mean but I THINK that's what I tried above. Or?


author: Srdjan_Boskovic
body: Re: <https://community.atlassian.com/t5/Jira-questions/Re-Re-How-do-I-update-status-of-an-issue-that-depends-o/qaq-p/2798070/comment-id/1047486#M1047486>

Yeah, that's what I''m trying to do. See flow above. The difference is that I can't use Edit Issue Fields component because it will operate on Y-2 or Z-3 issues and not on X-1. Like you wrote earlier, I need to change the context but I don't know how to do that. Do you know?


author: Simon K?nig
body: *Not sure if I understand clearly what you mean but I THINK that's what I tried above. Or?*

Yes it's exactly what I meant.

Could you also share the Logfile you can see in the Audit-Tab? Maybe this will give some more information on where exactly this rule fails.

I'm still not sure I understand your correct use case.

Correct me here:

You search for a Issue in Status "Backlog" and if found you want to iterate over all linked Issues via "depends on". When you find a Linked Issue with the Status "In Progress", then you want to Edit your "Backlog"-Issue to "In Progress" too? Or only if all are in progress or something else entirely?

Regards


author: Srdjan_Boskovic
body: thanks!

Some answers:

*"You search for a Issue in Status "Backlog" and if found you want to iterate over all linked Issues via "depends on". When you find a Linked Issue with the Status "In Progress", then you want to Edit your "Backlog"-Issue to "In Progress" too? Or only if all are in progress or something else entirely?"*

No, not quite. I search all linked issues, "children" (Y-2 and Z-3), to check their status.

If the status of ANY "child" is IN PROGRESS I want to update "parent" (X-1) status to IN PROGRESS.

I do this periodically and only for the "parents" that are in BACKLOG.

Makes sense?

*** ** * ** ***

*"Could you also share the Logfile you can see in the Audit-Tab? Maybe this will give some more information on where exactly this rule fails."*

So, what I originally posted is the cleaned up version of the automation rule, ie. without my email logs.

Here's the actual version log. Please ignore email actions. Also, note the printout from one of those email logs and example of my email log configuration. This is how I know that I have the right values and also that **{{issue.issuelinks.inwardIssue.key.status}}** is not working.

![Screenshot 2024-08-29 at 15.22.40.png](https://community.atlassian.com/t5/image/serverpage/image-id/344556iE462190FAEF9F28C/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 15.22.40.png")![Screenshot 2024-08-29 at 15.26.30.png](https://community.atlassian.com/t5/image/serverpage/image-id/344554i8F75C38F3B3B5618/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 15.26.30.png")![Screenshot 2024-08-29 at 15.28.16.png](https://community.atlassian.com/t5/image/serverpage/image-id/344555i32DC232137DF1930/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 15.28.16.png")

Just to clarify what this "log" is saying:

- NEXT-941 is IN PROGRESS.

- Its "parent" issue, GDPR-4, should be set to IN PROGRESS.

- {{issue.issuelinks.inwardIssue.key.status}} is a moot.

So, nothing is really failing, ie. no errors nor warnings. I just don't know how to change the "parent" (X-1, GDPR-4) status in case of hits like this.


author: Srdjan_Boskovic
body: [@Simon K?nig](/t5/user/viewprofilepage/user-id/4408131) any suggestions?


author: Srdjan_Boskovic
body: [@Simon K?nig](/t5/user/viewprofilepage/user-id/4408131) see above for the solution...Thanks a lot for your help...


Tags: cloud

jira-automation

jira-service-management

jira-service-management-cloud

loop