Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello,
I am trying to get the following up and running on JIRA 9.12.6 (using the built in Automation).
I have tried several versions (including branches), however nothing is working (the issue does not change Status).
I'm trying to get an issue to close under the following conditions:
Project A (Main Project)
Issue A-1
Subtask A-1a
Subtask A-1b
Subtask A-1c
Subtask A-1d
Project B (Linked issues to Project A)
Issue B-1
Issue B-2
Issue B-3
Issue B-4
Issue B-5
- All Linked issues from Project B must be Closed or Cancelled
- All Subtasks under Project A must be Closed or Cancelled
- If all of the above items are valid then close Issue A-1
Hello @AndreH
Can you show us what you have created so far for your Automation Rule?
What is the trigger for the rule? That will make a significant difference in what is possible within the rule.
So, in this specific execution the issue that triggered the rule is the HCP issue.
In your original description is the HCP issue the Project A issue or one of the Project B issues?
And do you want this to execute so that this is "one directional"? I mean, should only one of the projects be considered the Project A project, and the other one always the Project B project? Should it run
- only if the HD issue is the one with subtasks and HCP linked issues? or...
- only if the HCP issue is the one with subtasks and HD linked issues? or...
- in both cases; issues in either project could be the one with subtasks and issues linked to it from the other project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HCP is Project A
HD is Project B
Linked issues from HD (project B) need to be closed.
Subtasks from HCP (project A) need to be closed.
Once, done the HCP (project A) issue needs to close.
Project B (HD) is closed by other team members and does not need any automation.
So the focus is on Project A (HCP).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do you want to trigger the rule?
Should it be triggered when an issue in the HD project is closed?
And/or should it be triggered when a subtask in the HCP project is closed?
And/or do you want to run it on a schedule to periodically check all HCP issues to see if they should be closed now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @AndreH
Yes, and...to Trudy's suggestions:
As this scenario is for a Jira Data Center site, the lookup issues action is available. And so once the rule context is for issue "A-1" (with a branch), a single JQL statement may be used to gather all of the relevant issues (i.e., the subtasks and linked issues) and then check if they all meet the criteria needed to close "A-1".
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, indeed, I was getting to that point eventually. ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Should it be triggered when an issue in the HD project is closed? - Yes
And/or should it be triggered when a subtask in the HCP project is closed? - Yes
I thought that the validation would be for either one and which ever was the last with both being true would transition the HCP issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One more series of questions:
Can the HCP issue be linked to other issues in the HCP project itself?
If it can be linked to other HCP issues, will the Link Type used to link the HCP issue to the HD issue be unique and not used to link HCP issue to other HCP issues?
I believe you will need two different rules. The final details depend on the answers to the above questions.
Rule 1: triggered by closure of HD issue
Rule 2: triggered by closure of HCP subtask issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Links are going to be 99.9999% of the time from HCP to HD.
The HD issues are generated from workflow transition in the HCP ticket.
The users don't associate other issues in the HCP project.
I was hoping for 1 Rule (to rule them all).
I recreated the rule for a scheduled timer with JQL, waiting to see if this works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I split them into 2 separate item (subtask and issue links)
The subtasks has no issue.
The Issue Link has this issue, the JQL returns false positive. I am unable to only return only issues that have all of the links to be closed, it returns items that have some closed and some still open. Using (issueFunction in linkedIssuesOf)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please show us the rules you constructed.
When I said that there would need to be two rules, that is because the steps to achieve your goal of checking both subtasks and linked issues will be different depending on whether it was a subtask in the HCP issue that transitioned or a linked issue in HD that transitioned.
Here is the rule for when a subtask has been transitioned. I have not run this rule to test it, but I believe it will work.
This is the Create Variable step
The rule for when a linked issue in HD is closed is very similar. However, since the trigger is the HD issue, you need to use a Branch to shift the focus to the HCP issue to which it is linked.
For debugging purposes I would recommend that you use a Log action rather than a Transition Issue action, until you are sure the rule is getting the expected results. for the comparisons and Lookup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help, I'm half way there.
The second rule for HD links works without problems.
The first rule for the HCP Subtasks does not work. It claims that it successful, however the status does not change.
Here's the rule and Audit Log
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @AndreH
Notice the first statement in the Audit Log:
It would appear that you set up the subtasks rule to be scoped to a single project. That rule has to be scoped to multiple projects and specify both the HD and HCP projects. Both rules have to be scoped in that manner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I apologize. I see a mistake in the rule I provided to you for the sub-task scenario.
In the Lookup Issue action the JQL needs to be changed.
Instead of {{issue.key}} use {{issue.parent.key}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm going to walk through my debugging process...
In this last execution the issue that triggered the rule is HCP-150229. This is a subtask issue.
{{issue.parent.key}} is the issue key for that subtask's parent issue.
The Lookup Issues task says it is not finding any issues. That indicates there are no not-Done HD issues linked to the subtask's parent issue.
The final message in the log is that the trigger issue HCP-150229 doesn't match a condition. That would be the "Subtasks match" condition.
And now I see the problem with the solution I suggested. Since it is a subtask that triggered the rule, this condition will not work. This condition is trying to evaluate the subtasks of the trigger issue, which itself is a subtask.
One solution is to use another Lookup Issues action to find out if there are any sibling sub-tasks that are not Done, similar to what is done for the linked issues.
statusCategory != Done and parent={{issue.parent.key}}
Then add a Smart Values condition to check the size of the results:
{{lookupIssues.size|0}} equals 0
There could be alternative steps that could be used to accomplish the same thing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.