JIRA 9.12.6 Automation Help

AndreH April 11, 2024

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

 

Project Links.jpg

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

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.

AndreH April 11, 2024

2024-04-11_09-41-48.png

AndreH April 11, 2024

2024-04-11_09-44-55.pngIt shows the Status of Successful, however the Status of the Main ticket has not moved to Closed.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

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?

AndreH April 11, 2024

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).

 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

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?

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.
April 11, 2024

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

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

Yes, indeed, I was getting to that point eventually. ;-)

AndreH April 11, 2024

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.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

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

AndreH April 11, 2024

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.

AndreH April 12, 2024

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)

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2024

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.

Screenshot 2024-04-12 at 12.06.31 PM.png

 

This is the Create Variable step

Screenshot 2024-04-12 at 12.09.25 PM.png

 

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.

Screenshot 2024-04-12 at 12.14.10 PM.png

 

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.

AndreH April 16, 2024

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

2024-04-16_13-33-02.png2024-04-16_13-34-21.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 17, 2024

Hello @AndreH 

Notice the first statement in the Audit Log:

Screenshot 2024-04-17 at 12.17.01 AM.png

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.

Like Bill Sheboy likes this
AndreH April 17, 2024

I tried that, set bot rules to 2 Projects (HD, HCP) and Global (All). Neither of these settings Resolve the main parent issue.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 17, 2024

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}}

AndreH April 18, 2024

Still doesn't find any items and no status change.

 

2024-04-18_07-57-11.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 18, 2024

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.

Suggest an answer

Log in or Sign up to answer