Parent Inheritance of Child Tickets Multi-Field Values

Travis Hill April 2, 2024

Hello,

I am attempting something with automation that I havent messed with much before so hoping to get some clarity here.

This is the scenario:

We have Initiatives and nested under those Initiatives are Features and Enablers. We have a mutli-value field on the features and enablers that I would like to roll up to the parent initiative whenever that field is updated. The issue here is that I need the values from all of the child features and enablers to roll up continuously. 

So basically the parent needs to reflect the combination from all multi field values from all of the child tickets

As an example:

Feature 1 has values A, B, C, D in the multi field value

Feature 2 has values C, D, E in the multi field value

Feature 3 has values A, E in the multi field value

Feature 4 has values F in the multi field value

The parent of these features should show values A, B, C, D, E, F in the multi field value

Additionally if Feature 2 deletes D from the multi-field value, it should still show in the parent because it is still linked in Feature 1

Any thoughts on how I could approach this? Thanks in advance.

 

1 answer

1 accepted

2 votes
Answer accepted
Kalyan Sattaluri
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 2, 2024

Hello @Travis Hill 

To clarify, your trigger is field change on the feature and if that field is updated, you want to find that feature's initative, find all features/enablers of that initiative, and then copy these values over?

If so, can you tell:

  • Are all these issues in the same project?
  • Does Initiative has the same multi field values as feature?
  • Is this multi value field, a checkbox?
Travis Hill April 2, 2024

Thanks for reaching out. That is exactly the scenario yes. When that trigger field is updated it should find that tickets parent then spot check all children of that parent and copy those values over, exactly!

As far as the answers to your questions above, it is yes to all three

 

Kalyan Sattaluri
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 2, 2024

Hello,

<edit - summarizing steps for quick reference>

  • We start with issue trigger where a feature's checkbox field is edited.
  • Using that trigger, we know the parent initiative which is {{issue.parent}}, this gives us the key of parent initiative.
  • Using parent key, we find all Features / Enablers using lookupIssues JQL.
  • Once we have all features/enablers, we can access their check box values using {{lookupIssues.Agile Release Train.value}}
  • But because each issue can have multiple values, above smart value gives us a list of arrays, which looks like, [OPTION1, OPTION 2], [OPTION1, OPTION 3]
  • We cannot use that output format to update directly so we start cleaning the data.
  • We first remove the square brackets which will give us nice output of OPTION1, OPTION2, OPTION1, OPTION3
  • Now above is a list and we can iterate.
  • But to update a field like multi value check box, JSON has to be in certain format. 
  • So we do the magic of last step, that is we iterate the above list and make it output the same list in a JSON format which can be used to update the field on the initiative.

</edit>

So, start a new rule with:

  • Trigger = Field Value changed., select your checkbox field as trigger field.
  • If condition -> Issue type == Feature & Enablers
  • Log Action  - > {{issue.Parent Link}}
  • Action -> lookupIssues -> JQL => issuekey in portfolioChildIssuesOf("{{issue.Parent Link}}") and issuetype in (Features, Enablers)
  • Log Action -> {{lookupIssues.key}}

Please cross check my JQL for lookupIssues...

Create this rule, trigger the rule by adding/remove a value from the check box field and share the audit log. We need to see if lookupIssues gets all features/enablers

 

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 2.20.46 PM.png

Travis Hill April 2, 2024

It looks like it found all the child issues as you can see with the linked issues above. Those are the only two under that particular parent.

However it didnt update the parent to reflect the changes made to the child. Im assuming I missed a then statement to say update parent?

Kalyan Sattaluri
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 2, 2024

Hello,

No, we havent gone that far, :p.

In your rule, can you next log {{lookupIssues.Your Field.value}}

Replace bolded part above with actual field name.

Then, select few values in both the features, preferrably duplicates..

And share the audit log again.

We still havent updated the Initiative yet, we are getting there.. I promise.

 

 

Travis Hill April 2, 2024

I trust you! 

Ok I added the same value to the field on each of the child tickets, here is the audit log

Screen Shot 2024-04-02 at 2.54.07 PM.png

Kalyan Sattaluri
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 2, 2024

Can you share your rule screenshot as well. As you can see, last 2 log statements are not printing correctly so something if off..

Also, make sure {{lookupIssues.Your Field.value}} has your correct field name...

image.png

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 3.04.32 PM.png

 

Im wondering if I need to use the custom field id instead?

Kalyan Sattaluri
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 2, 2024

2 things.

Please use lookupIssues, not lookupissues... (capital I instead of lower case i)

So change it to {{lookupIssues.key}}

And the last lookup, change it to {{lookupIssues.Agile Release Train.value}}

Please update both, trigger rule by adding a check box field and share audit log. Thanks!

Travis Hill April 2, 2024

I think we got it! 

 

Screen Shot 2024-04-02 at 3.16.57 PM.png

Kalyan Sattaluri
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 2, 2024

Great. I am going to list down series of next steps. I am not in front of computer right now so Please implement them and share screenshot of the rule and audit log as you go long to understand issues.

Next:

  • Action -> create a new variable, call it myvar and assign it below smart value (see first screen shot below)

{{#lookupIssues.Agile Release Train}}{{value}}{{^last}},{{/}}{{/}}

  • Log Action ==> {{myvar}}
  • Then Action -> lookup Issues = key = {{issue.Parent Link}}
  • Then Advanced Branch => smart value = {{lookupIssues.key}} & give any variable name such as myInitiative
  • Add to branch - Action -> Edit Issue -> Expand "More Options"
  • In the Additional Fields Section, delete everything there and replace with below (see screenshot 2)

{
"fields": {
"Agile Release Train": [ {{#myvar.split(", ")}}{ "value": "{{.}}" }{{^last}}, {{/}}{{/}} ]
}
}

 

Trigger rule by making change to a field and share rule screenshot and audit log:

image.png

 

image.png

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 4.29.40 PM.png

 

Looks like were pretty close, its pulling everything in accurately to the Log but failing to add it to the parent. But as you can see from the last Log Action there is no space between the two variables, could that be the issue?

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 4.31.34 PM.png

Screen Shot 2024-04-02 at 4.31.47 PM.png

Kalyan Sattaluri
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 2, 2024

Yes, those values should be separated by commas.

So there are few corrections I had to make. So please delete earlier steps and please redo like below:

your variable myvar should be: 

{{lookupIssues.Agile Release Train.value}}

image.png

 

Then do branch -> Choose JQL and give query = key={{issue.Parent Link}}

image.png

 

Then do a log action and log below value to verify:

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").replace(" ","").split(",")}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

image.png

Then edit issue -> Additional Fields - Remove existing JSON and replace with below:

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").replace(" ","").split(",")}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

image.png

 

 

Your last few steps should look like below:

image.png

 

Please clear steps from my earlier post and implement these from the "Create Variable" step onward, trigger rule and share audit log if issues.

*fingers crossed*

Travis Hill April 2, 2024

looks like were hitting a similar snag. Seems like it errors out with the Additional Fields query.

Screen Shot 2024-04-02 at 6.47.40 PM.pngScreen Shot 2024-04-02 at 6.48.00 PM.png

Kalyan Sattaluri
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 2, 2024

Hey,

no.. we are almost there.. 

Can you, before your edit issue in the last step, in the log action.. replace existing string with below value and share edit log.. I was stripping spaces in your fields..I need to check if I need to do that or not..

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").split(",")}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 7.07.05 PM.png

 

Same error looks like

Kalyan Sattaluri
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 2, 2024

OK. Another edit :p

Please use below JSON in log and also in the edit issue replacing existing content.. Just had to trim extra white spaces..

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").split(",").trim}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

 

Travis Hill April 2, 2024

Screen Shot 2024-04-02 at 7.20.28 PM.png

Still coming through with the same issue :/ 

Kalyan Sattaluri
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 2, 2024

You've updated it in both places the above JSON?

Including the edit issue section?.. The last step?

Please share the log right before this error..

Kalyan Sattaluri
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 2, 2024

Please replace highlighted section in below screenshot with below JSON::

 

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").split(",").trim}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

 

 

image.png

Travis Hill April 2, 2024

Yeah, copied that over into both places. I believe this was the audit log before we made that change:

Screen Shot 2024-04-02 at 7.48.00 PM.png

Kalyan Sattaluri
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 2, 2024

Sorry, that audit log is from before..

I know we have been at this for a while so apologies

But please copy below JSON in both places of last 2 steps and trigger the rule again. 

I have tested this in my jira and it works.

{
"fields": {
"Agile Release Train": [ {{#myvar.remove("[").remove("]").split(",").trim}}{ "value": "{{.}}" }{{^last}},{{/}}{{/}} ]
}
}

Travis Hill April 2, 2024

No need to apologize at all. Youre an absolute rockstar and I appreciate your help greatly! I spot checked everything and Im still getting the same error. Let me drop the latest audit log and a screen shot of the flow for reference because I know im missing something small

Screen Shot 2024-04-02 at 8.07.06 PM.pngScreen Shot 2024-04-02 at 8.08.17 PM.pngScreen Shot 2024-04-02 at 8.08.25 PM.pngScreen Shot 2024-04-02 at 8.08.31 PM.png:

 

Kalyan Sattaluri
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 2, 2024

Can you Please share screenshot of the details of the edit issue fields screenshot which shows the JSON?

 

 

Travis Hill April 2, 2024

Absolutely! Here it is.

Screen Shot 2024-04-02 at 8.21.26 PM.png

Kalyan Sattaluri
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 2, 2024

OK, so every thing is correct.

Only thing I can think of is, in the edit section. the field "Agile Release Train" is not working.

We need to find the custom field value for this one.

If you dont know this value already..

  • Open Jira
  • In new browser tab, put below url, replace bolded part with your jira instance and an issue key of an initiative which has this check box selected.

https://yourdomain.net/rest/api/2/issue/RD-2643?expand=names

  • If you see a response, copy all JSON to a notepad, Cntrl+F to find, "Agile Release Train" and find the customfield value name beside it.

Please refer to this process for details  on this step:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

And once you find it.. replace "Agile Release Train" with that value in edit section, something like below:

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

 

Since its late, maybe we can tackle this tomorrow. Sorry it ended up being marathon.. I wasnt on my other machine earlier..

Travis Hill April 3, 2024

That was it!! Just needed the custom field id and now its working like a charm!!

This is amazing and I really appreciate your help on this. I never would have figured it out.

Like ish.mustafa likes this
Kalyan Sattaluri
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 3, 2024

Awesome. 

Given that its working, I will summarize what we did for reference:

  • We start with issue trigger where a feature's checkbox field is edited.
  • Using that trigger, we know the parent initiative which is {{issue.parent}}, this gives us the key of parent initiative.
  • Using parent key, we find all Features / Enablers using lookupIssues JQL.
  • Once we have all features/enablers, we can access their check box values using {{lookupIssues.Agile Release Train.value}}
  • But because each issue can have multiple values, above smart value gives us a list of arrays, which looks like, [OPTION1, OPTION 2], [OPTION1, OPTION 3]
  • We cannot use that output format to update directly so we start cleaning the data.
  • We first remove the square brackets which will give us nice output of OPTION1, OPTION2, OPTION1, OPTION3
  • Now above is a list and we can iterate.
  • But to update a field like multi value check box, JSON has to be in certain format. 
  • So we do the magic of last step, that is we iterate the above list and make it output the same list in a JSON format which can be used to update the field on the initiative.

This last step of looking up customfield is a glitch in Jira and should have worked directly. 

Please test few more scenarios and if its working as expected, consider accepting solution. Folks in future may find it hard but hopefully they can benefit.

Thanks!!

 

Like ish.mustafa likes this
Travis Hill April 3, 2024

Tested it out on a few more and it seems to be working perfectly. Thank you for walking me through this. Appreciate it greatly!

Like # people like this

Suggest an answer

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

Atlassian Community Events