Page 1 of 1

Nested Work Item List in Wiki Page

Posted: Wed Jun 29, 2011 10:57 am
by ajaywazir
Hi
In Polarion 2010 ALM pro
is there a way to list workitems and linked workitems in a nested format (as in the workitem query window - direction impact)?
in a wiki page.
Regards
Ajay Wazir

Re: Nested Work Item List in Wiki Page

Posted: Fri Jul 01, 2011 8:16 am
by Zwi_B&R
Hi!

I'm not sure what you want to do, but maybe following example might help you.
It builds a table with all backlinked workitems (with specified link role; sorted by "id").
Example Call: #WIlistLinked("TEST-123" "depends_on")

Code: Select all

##--- macro to build a table of linked workitems (for document overview) --------------------------
#macro( WIlistLinked $WInr $LinkRole)
 #set($query="id:$WInr")
 #set($WIs=$trackerService.queryWorkItems($query, "id"))
 #foreach ($wi in $WIs)
    {table}
    Workitem | Title
    #foreach ($link in $wi.getLinkedWorkItemsStructsBack("id") )
        #if ($link.getLinkRole().id==$LinkRole)
            #set($linkeditem=$link.getLinkedItem())
            {workitem:$linkeditem.project.id/$linkeditem.id|display=short} | $linkeditem.title
        #end ##if
    #end ##foreach
    {table}
 #end ##foreach
#end ##macro


Note: the wiki sometimes has troubles with the syntax; e.g. if you have an #if .. #end in the last column. In this case you have to use html syntax which should always work.