How can I query for work items that do NOT have a parent
![]() As stated, I'd like to find workitems in my system that do not have a parent relationship defined. I like to have all my work items nested under a story, but sometimes the devs create a work item and forget to set the parent.
How can I find them?
Also, if there is a way to make setting the parent relationship a requirment before a workitem can be saved, that would prevent future occurences. |
Accepted answer
![]()
Daniel Toczala (882●1●15●14)
| answered Jan 29 '13, 10:18 a.m.
FORUM MODERATOR / JAZZ DEVELOPER edited Jan 29 '13, 10:27 a.m.
Building on what Sam showed, there is a Parent choice in the query builder. Select it, and then note that you can choose to include a work item if the parent exists, or does not exist. In your case, you want "do not exist".
![]() Hooch Holly selected this answer as the correct answer
|
2 other answers
![]() Doh! I don't know how I missed the "Parent" field in the Query builder. Thanks! |
![]()
I see Parent as a choice in the Query builder. both web and eclipse..
allows me to check has or does not have parent set.. ![]() ![]() don't think there is a required dependent link function built in. |
Comments
Are you willing to do some OSLC?
If you want to restrict this to a project area, call this URL as follows:
accept: application/xml
OSLC-Core-Version: 2.0
{YOURrOOT}'/ccm/oslc/contexts/$projectAreaID/workitems?oslc.prefix=rtc_cm=<http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/>&oslc.properties=rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent
rdfs:member entries will either contain the tag rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent or not so you can find the parents. Note that the call is paging type; you'll have to check for oslc:nextPage in the result and if present, iteratively call it until all pages of data have been fetched. THere is no way to filter for items whose parent is a story; the filtering doesn't "read thru" the resource link.