Forums

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

Aggregate field values from all Epics under an Initiative

Shir Avtabi May 30, 2024

Hi all,

I'm trying to find a way to create an automation that’ll inherit "Domain" field values from all Epics to their parent Initiative everytime the field values are updated or when the parent is changed. 

I found a way to make it happen but there's an issue if the Initiative has 2 Epics or more under it: The values in the Initiative will stay as they are and the automation just adds the new values to it - But keeps the old values as well which are no longer relevant:

domain auto old 3.png

To solve this I tried to first clear the Initiative "Domain" values (every time the Epic's "Domain" field is changed) and re-fetch the values again - But then it only takes the values from the Epic that was modified (the trigger issue), so it's not working for me.

Another idea was to use a variable or lookupissues to get a list of all the Epics under the Initiative - capture the values of "Domain" from all of them - and then put them back in the Initiative. When I tried that I got the following error:

(Specify the value for Domain in an array (Domain))

Any idea how to get past this error?

here's what I tried:

Domain auto.pngDomain auto 2.pngDomain auto - error.png

1 answer

1 accepted

0 votes
Answer accepted
Stevan Mandić
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 30, 2024

Instead of using "fields" (value:), try using: "update" (set:)

"update": {
"Domain": {
"set": 

Take a look at the difference between "update" and "fields":
here 

Shir Avtabi May 30, 2024

Hi @Stevan Mandić , thanks for your reply. 

the goal here is to aggregate all the Epic's field values to the Initiative parent which means I'll have to clear the Initiative field first, so in this case "update" or "set" doesn't matter. Otherwise, it may keep the values that are no longer in another Epic's field. 

I believe the issue is more related to the format expected by the field that differs from the one I get with the lookupissue. 

domain auto 5.png

Stevan Mandić
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 30, 2024
Stevan Mandić
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.
June 3, 2024

@Shir Avtabi  here is the working solution, just replace XXXXX with your Domain Field ID (both in variable and edit action)

this rule will always keep Initiative Domain field values updated when child Domains change.

1)Trigger: Field value changed (Domain)

2)Condition - issuetype equals Epic

3) Lookup issues - JQL:

issuekey in portfolioChildIssuesOf("{{issue.Parent}}") and issuetype = Epic

 

4) Create variable - "childDomains":

{{lookupIssues.customfield_XXXXX.value}}

 

5) Branch For: Parent

 

5.1) Edit issue fields - More options:

{
"fields": {
"customfield_XXXXX": [ {{#childDomains.remove("[").remove("]").split(",").trim}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

 

 

Shir Avtabi June 5, 2024

@Stevan Mandić This works perfectly!

Thank you so much, I appreciate your help!

Like Stevan Mandić likes this

Suggest an answer

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

Atlassian Community Events