Hi community,
I'm trying to create a filter that returns the parent of the parent of a generic issue or work item, depending on the terminology used.
At the moment, I have thought of two approaches:
Populate a custom field "grandparent" using a Script Listener.
Use Enhanced Search leveraging the parentOf() function. However, I have some doubts about this second option:
Regarding the second parameter of the parentOf() function: it seems you should specify the degree of parentage, but the only available option appears to be all (even after performing a full reindex). Could you please explain better how this parameter works?
If I save the filter and share it with other users, will the query remain editable? I would like to know if it is possible to dynamically change the issuekey in the query to search for the "grandparent" of other issues, without having to create a new filter each time.
Thanks in advance for your help!
---------------------------------------------------------------------------------------
Ciao community,
sto cercando di creare un filtro che restituisca il parent del parent di una generica issue o work item, a seconda della terminologia utilizzata.
Al momento ho pensato a due approcci:
Popolare un custom field "grandparent" tramite uno Script Listener.
Utilizzare Enhanced Search sfruttando la funzione parentOf(). Su questa seconda possibilità però ho alcuni dubbi:
Riguardo il secondo parametro della funzione parentOf(): si dovrebbe specificare il grado di parentela, ma sembra che l'unica opzione disponibile sia all (nonostante io abbia effettuato la sincronizzazione completa). Potete spiegarmi meglio il funzionamento di questo parametro?
Se salvo il filtro e lo condivido con altri utenti, la query rimane modificabile? Mi interessa sapere se è possibile sostituire dinamicamente l'issuekey nella query per cercare i "grandparent" di altre issue, senza dover creare ogni volta un nuovo filtro.
Grazie in anticipo per l'aiuto!
Hello @Gaetano Antonio Turturro
Regarding the second parameter of the ScriptRunner parentsOf() function, there are only two options:
1. get just the immediate parent issue of the issues described in the subquery.
2. get all the ancestors (parent, grandparent, great-grandparent, etc.) of the issues described in the subquery
It is not possible to specify a specific level in the hierarchy, such as grandparent.
You could create an Enhanced Search filter to get the direct parents of the issues. Save that filter, and then use that filter as the subquery of another parentsOf() filter.
Example:
filter1 = issuefunction in parentsOf("Project=ABC and type=Story")
filter2 = issuefunction in parentsOf("filter=filter1")
Hi @Trudy Claspill , this solution definitely works and I thank you for it, but it doesn’t seem very "clean" to me.
On the other hand, the custom field feels like an unnecessary burden, so I think I'll go with the first option.
This way, if the user wants to modify the filter to retrieve the grandparents of a different issue, they will need to adjust the first "subfilter" and then move to the second filter.
Let me know if I misunderstood anything.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
or some reason, it’s not working as expected. I've come up with a new strategy using ScriptRunner:
Add a workflow action (a transition that loops back to the same status) which dynamically updates a filter to show only the grandparent of the current issue.
I'm sending you the screenshots that show the Enhanced Search, as configured following your suggestion, is returning no results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your "parent" filter shows that one issue was found (XR2J-6) that is a Parent of issues in the specified project.
Your "grandparent" filter shows no results.
The issue image you provided doesn't include the key of the issue being viewed.
What type of project are you working with? Get that information from the Type column on the View All Projects page under the Projects menu.
Are all the issues in the hierarchy in the same project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Gaetano Antonio Turturro
Are you interested in debugging what is happening with the nested ScriptRunner filters? If so, can you provide the information I requested in my previous response?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Trudy Claspill , and sorry for the delay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have any hierarchy levels above Epic?
I had the same experience when I replicated this in a project that has just the three hierarchy levels.
Reviewing the documentation for parentsOf()
... it seems that if you don't include the option "all" parameter then the results are only the parents of subtasks that match your filter. It does not return parents for any other issue type at a different hierarchy level in that case.
So in your case you would need to use this type of filter to get the Epics:
issuefunction in parentsOf("project=YourProjectName", "all") and type=Epic
That would get you all the ancestors of the subtasks, and then reduce that list to only the ones that have an issue type of Epic.
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.