wi.getLinkedWorkItems not returning LinkedWorkItems

Description
ssinnott
Posts: 4
Joined: Thu May 17, 2018 11:00 pm

wi.getLinkedWorkItems not returning LinkedWorkItems

Postby ssinnott » Tue Jul 17, 2018 9:08 pm

Hi,

I have a script block on a LiveReport page that is cycling through a list of WorkItems and looking for all the linked WorkItems that have a role of "dulplicates".

In the API documentation the WorkItem function 'getLinkedWorkItems' returns and array of LinkedWorkItems, which I can cycle through and get the role. However, the function seems to return an array of WorkItems, rather than LinkedWorkItems. I am unable to get the role of the LinkedWorkItem. When I return 'getId' from the linked work item I get the ID of the WorkItem, indicating that this is an array of WorkItems, rather than LinkedWorkItems.

In the following code I have extracted all the WorkItems ($wis) from a module:

Code: Select all

#foreach ($wi in $!wis)
    #set ($linkedwis = $!wi.getLinkedWorkItems)
    #foreach ($link in $!linkedwis)
      #if ($!link.getRole.getId == "duplicates")
        #set ($covered = $!covered + 1)
      #end
    #end
#end


Am I doing something wrong with this code, or is it a defect?

regards

Simon

rpn
Posts: 23
Joined: Thu Oct 26, 2017 4:08 pm

Re: wi.getLinkedWorkItems not returning LinkedWorkItems

Postby rpn » Tue Jul 24, 2018 11:02 am

Iam using the .NET-Wrapper library, so I can't test your code directly, but that function behaves as documented in my programs. I call the function on the "tracker"-service, rather than the item itself. IIRC that option is also given in the polarion-Scripting-Environment, maybe worth a try to call the service directly and supply the items uri to get the linked items?
No native speaker, sorry for my bad English.

ssinnott
Posts: 4
Joined: Thu May 17, 2018 11:00 pm

Re: wi.getLinkedWorkItems not returning LinkedWorkItems

Postby ssinnott » Tue Jul 24, 2018 11:59 pm

Thanks for your reply.

I did work this out. The list that I returned from my query was a list of IWorkItem, rather than WorkItem. Once I established that I could use $!wi.getLinkedWorkItemsStructsBack to return the list of links.

regards

Simon


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 5 guests