Forums

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

Jira Cloud Automation Sub Task Component Field Edited

Ian Robinson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 28, 2020

Is there a way in Jira Automation to automatically build the list of components associated with a parent issue (Story, Bug, Task) as a summation of all components associated with all of its sub-tasks?

 

Thanks

 

Ian

2 answers

0 votes
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 30, 2020

Hey @Ian Robinson ,

It may be possible. It depends on what you want to do with that list and what event you want to trigger it?

Cheers,

Simeon.

0 votes
John Funk
Community Champion
August 28, 2020

Hey Ian,

You could probably update the parent with the value of the Sub-task as each Sub-task is created. And probably even as the component field is updated for each Sub-task.

But I don't know about doing that on existing records where the values are not being updated. 

Ian Robinson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 31, 2020

Hi John,

This is what I have so far and it works for adding a component to the list on a sub-task. What I haven't figured out yet is if I remove a component from a sub-task how to remove if from the parent only if it is not included in the component list of any other sub-task of the same parent.

JiraAutomationComponentRoll-up.png

John Funk
Community Champion
August 31, 2020

@Simmo  - Any thoughts on how to update a related issue to REMOVE a value that was removed from the trigger issue? 

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 1, 2020

Hey @Ian Robinson & @John Funk ,

This is more tricky than it seems. I've been playing with a few ideas. Just waiting for a team member to be back tomorrow to see if it is possible.

Cheers,

Simeon.

Like John Funk likes this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 2, 2020

Alright, @Ian Robinson & @John Funk aka Funkmaster!

What a curly one. You've no idea how hard this was. It is very hard to get the fields that were removed and the fields that were added out of the Field Value changed trigger because we're dealing with a multi select so its sets of values.

The approach I took was: whenever the components change on a sub task, recalculate the parent based on all its children. However, even that was hard. 

The reason being is that components is a list, eg EG-1 with [a, b] and EG-2 with [c, d].

If i do a smart value of issue.subtasks.components.id then i get all the ids for all the sub tasks. BUT, see the bolding? They're both lists. And they're nested so you end up getting a list of lists: [ [a, b], [c, d] ]. And we can't work with that easily. Eg, this does not work:

edit1.pngThe reason being that it just expects a list of values. Not a list of lists.

So, we've had to go hardcore. It has taken myself and Sam a while to come up with a smart value that can create JSON so that we can do this in the advanced section.

The result:

edit2.pngSo, what is this doing? In short, the smart value is producing this:

{ "id": "11001" } , { "id": "11167" } , { "id": "11002" } , { "id": "11167" } , { "id": "11165" }

which is json and we can use in the advanced fields.

I'm not sure how reliable this will be but its the best I can offer. 

Here's advanced fields text:

{
"fields": {
"components": [ {{#issue.subtasks}} {{#components}}{{^isEmpty}} { "id": "{{id}}" } {{/}}{{^last}}, {{/}}{{/}}{{^last}}{{^components.isEmpty}}, {{/}}{{/}}{{/}} ]
}
}

and my rule:

rule.pngIf that still doesn't work, we might have to give up on this one! Best of luck!

Simeon.

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events