I have a custom field that is of type label. Any time this field is changed on a subtask, I would like to overwrite the parents field with all the labels from its children tasks.
I have the easy part done below, now I need to replace "bugfix","blitz_test" with the syntax to get each label from all tasks siblings and add them to the parent.
Thank you
To add all of the labels from all of the subtasks, you first need to get all of those labels.
One way to do that is with the Lookup Issues action:
Kind regards,
Bill
Hi @Bill Sheboy thank you very much! With your guidance I almost got the exact result I'm looking for. Except that the labels are being added with [ ] around them. I tried to substitute asJsonStringArray with asJsonString but I get errors.
Is there an easy way to remove the [ ] from the labels?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmmm...the question is, what is adding them: the initial parsing or the later conversion to the JSON string array.
Let's assume it is the first one, and so use this as the source to try removing them:
{{lookupIssues.yourCustomFieldName.remove("[").remove("]").distinct.asJsonStringArray}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again Bill, it looks like it was latter. I was able to address it removing all the square brackets after array and then wrapping it all in a single [ ] to get my desired outcome:
[{{lookupIssues.yourCustomFieldName.distinct.asJsonStringArray.remove("[").remove("]")}}]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done, Craig!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Craig Easton and welcome to the community,
I´m not quite sure if I can follow correctly. What exactly does "all tasks siblings" mean?
So to clarify:
Am I assuming right that when Issue-A is the parent and Issue-B is the subtask --> when Issue-B field Teams is updated then labels from Issue-B should be written to Issue-A (parent) and overwrite eventually already existing labels there?
If so the following does the work:
If your customfield is not available in the dropdown this advanced edit in JSON would should work:
{
"fields": {
"customfield_10062":
{{triggerIssue.customfield_10062.asJsonStringArray}}
}
}
BTW: you can find an excellent docu of advanced JSON edit here:
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Adding-labels
Please let me know if this was helpful.
Best
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Stefan Salzl thanks for the response.
Yes in your case, what you describe does work. However it fails in the following scenario:
Issue A - Parent
Issue B - Subtask of Issue A
Issue C - Subtask of Issue A
Add Team-B to Issue B -> Issue A Team = Team-B
Add Team-C to Issue C -> Issue A Team = Team-C
What I would like the result to be is that Issue A has Team = Team-B, Team-C
As well, if I removed Team-C from Issue C I would like Issue A to be reflected with Team = Team-B.
I hope that makes sense and why the 'copy x from trigger issue' didn't work for me even though my custom field is listed there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If Issue-B is subtask of Issue-A how can Issue-C be a subtask of Issue-B? Logically this would mean Issue-C is a subtask of a subtask.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry that was a mistake, I fixed it.
Issues B and C are subtasks of Issue A.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.