Populate a field from child tickets

Christopher Atkinson March 15, 2024

Hi all,

 

I'm wondering if anyone out there has any advice or a solution to the following:

I want to run a report of how many "Initiatives" Teams are involved in and spot when they are overloaded in a more instantly visual way that I can see to do in Jira/ Advanced Plans.

I am trying to work out how to populate a field in a parent ticket by copying values from the children ticket.

Eg:

Parent Ticket - Field: "Teams Involved" - Value: "Team A" "Team B"

 

Child Ticket A-  Field: "Team" - Value:  "Team A"

Child Ticket B-  Field: "Team" - Value: "Team B"

 

 

The automation has also got to cope with:

- Tickets from the same team being added and not trying to duplicate the current Team Value,

- Some Tickets being removed but not removing the Team from the Parent if some are still linked,

Thanks in advance!

 

2 answers

1 accepted

0 votes
Answer accepted
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 16, 2024

Hi @Christopher Atkinson 

Can I confirm the logic here...

  • The Parent will have a field - eg. Select List (multiple choices) with all Teams in it
  • The Children will use the standard Team field
  • Each Team should be displayed just once at the Parent level
  • If an issue is removed and no other issues have that Team, remove them from the Parent

...is this correct?

Ste

Christopher Atkinson March 20, 2024

Yes, that look about right

 

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

Hi @Christopher Atkinson 

Rule is below. Please see the notes for some additional information.

---

Prerequisites:

  • Get the custom field ID for Team in your instance - eg. 10001
  • Create a Select List (multiple choices) at Epic (or parent) level, eg. All Teams. Populate with all available Team options.

---

  • (1) Trigger: Field Value Changed
    • Field to monitor = Team
    • Change type = Any changes to the field value
    • For = All issue operations
  • (2) Condition: Issue Fields Condition
    • Field = Issue Type
    • Condition = is one of
    • Value = Task, Story
  • (3) Condition: Related Issues Condition
    • Related issues = Parent
    • Condition = Exists
  • (4) Action: Lookup issues
    • JQL - parent = {{triggerissue.parent}}
  • (5) Action: Create variable
    • Name = TeamList
    • Smart value = {{#lookupIssues}}{{#customfield_10001}}{{name}}; {{/}}{{/}}
  • (6) Action: Create variable
    • Name = AllTeams
    • Smart value = {{TeamList.split("; ").distinct.join(",")}}
  • (7) Branch: Related Issues
    • Type = Parent
      • (8) Branch-Action: Edit Issue
      • More options...
        • {
          "fields": {
          "All Teams": [
          {{#AllTeams.split(",")}}{"value":"{{.}}"}{{^last}},{{/}}{{/}}
          ]
          }
          }

---

Notes:

  • (1), the Trigger, could be multiple events - including a Team being added or removed to an existing child, a new child being added, a child being removed, etc. You could either...
    • Have multiple rules, with different Triggers - I think you'd need at least two...
      • Field Value Changed = Parent
      • Field Value Changed = Team
    • Run this rule on a Schedule, to avoid unnecessary triggers and executions
  • (2) can be limited to whichever issue types are relevant as children of the parent.
  • (5) is where the Team custom field ID is used
  • (8) updates the Select List (multiple choices) at the parent level. The values in here need to match all Team options available (based on the names) for this to work.

---

Give this a go, and let us know if it works for you :)

Ste

Like Christopher Atkinson likes this
Christopher Atkinson March 21, 2024

Hi @Stephen Wright _Elabor8_ ,   

 

Thanks for the suggestion above!   

I've put it in place and the audit log is saying that I have success.... BUT I don't see any of the Team Names appearing as selected.   Any ideas?

 

I've checked that the list matches the names of the teams...

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

Hi @Christopher Atkinson 

The Audit Log will display as successful because the variable(s) are created, even if the wider rule doesn't work.

I usually use "Log Action" actions to check each variable is working as expected.

I'd suggest...

  • Add a Log Action before (5), using the smart value {{#lookupIssues}}{{#customfield_10001}}{{name}}; {{/}}{{/}}
  • Add a Log Action before (6), using the smart value {{TeamList.split("; ").distinct.join(",")}}

This will let you review if these are working as expected in the audit log. You can also provide a screenshot of the results here and we can take a look if useful :)

Ste

 

Like Christopher Atkinson likes this
Christopher Atkinson March 21, 2024

Amazing!   Will let you know when I've got something

 

Christopher Atkinson March 21, 2024

Here is the audit log... and the field inside the ticket....

 

Screenshot 2024-03-21 at 10.45.11.pngScreenshot 2024-03-21 at 10.45.36.png

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

The second Log Action looks incorrect, {{TeamList.split("; ").distinct.join(",")}} should change the list...

  • From: Team 4; Team 5; Team 3...
  • Into: Team 4,Team 5,Team 3

Can you send a screenshot of the two Variable creation actions?

Ste

Christopher Atkinson March 21, 2024

Screenshot 2024-03-21 at 10.56.11.pngScreenshot 2024-03-21 at 10.55.58.png

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

Hi @Christopher Atkinson 

I'm not saying it is this, but there's a space missing in the second one, with the smart value I used being {{#lookupIssues}}{{#customfield_10001}}{{name}}; {{/}}{{/}}

There's a space after the - but, I removed the space in my rule and the rule continued to work correctly.

---

Perhaps provide a screenshot of your whole rule, with the right-hand side visualising the "Edit Issue Fields" option in the Parent field.

A lot of checks I know, but I know this can work as I have it running on one of my instances :)

Ste

Christopher Atkinson March 21, 2024

Here is the rule... 

Screenshot 2024-03-21 at 11.38.52.png

 

Thanks again for your help on this!

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

In the Edit Issue action, you've used TeamsInvolved...

{{#TeamsInvolved.split(",")}}{"value":"{{.}}"}{{^last}},{{/}}{{/}}

...instead of the variable you created, so it should be...

{{#AllTeams.split(",")}}{"value":"{{.}}"}{{^last}},{{/}}{{/}}

Ste 

Like Christopher Atkinson likes this
Christopher Atkinson March 21, 2024

Victory!    Thanks so much for helping me through this!  

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 21, 2024

Awesome, glad it works :)

Could you accept this answer if possible? It indicates to others who find this question in future that this answer can help them too :)

Ste

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.
March 15, 2024

Hello @Christopher Atkinson 

You might want to use a Labels custom field in your parent issue.

You could create a scheduled rule that gets a list of the parents that you want to update.

Then for each parent you would

- clear the custom Labels field

- walk through the child issues

- pull the Team value from each child and add it to the custom Labels field of the parent.

If the Team value is already present in the custom Labels field, it won't be added again.

 

Another alternative that might work would be a rule triggered by a change to the Team field of a child issue. I haven't worked out the details on that rule.

Suggest an answer

Log in or Sign up to answer