Remove Workitem links within wiki

Description
thomas.boll
Posts: 7
Joined: Wed Sep 02, 2015 12:34 pm

Remove Workitem links within wiki

Postby thomas.boll » Wed Sep 02, 2015 12:42 pm

Hello,

I tried to remove links between workitems from a wiki site, but it doesn't work.

Code: Select all

   #foreach ($Link in $WI.getLinkedWorkItemsStructsDirect())
      #set ($ret = $WI.removeLinkedItem($Link.getLinkedItem(), $Link.getLinkRole()))
      ret = $ret\\
   #end
   #foreach ($Link in $WI.getLinkedWorkItemsStructsBack())
      #set ($ret = $Link.getLinkedItem().removeLinkedItem($WI, $Link.getLinkRole()))
      ret = $ret\\
   #end


I get always "true" as return value, but wenn I view the workitem in browser all links are still there.

I hope someone can help me.
Thomas

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Remove Workitem links within wiki

Postby martins » Thu Sep 10, 2015 11:11 am

Hello Thomas,

Is your code embedded in a transaction AND are you calling $WI.save()?

Code: Select all

$transactionService.beginTx()
#foreach ($Link in $WI.getLinkedWorkItemsStructsDirect())
      #set ($ret = $WI.removeLinkedItem($Link.getLinkedItem(), $Link.getLinkRole()))
      ret = $ret\\
#end
$WI.save()
$transactionService.commitTx()

This should work.

Kind regards

Martin

thomas.boll
Posts: 7
Joined: Wed Sep 02, 2015 12:34 pm

Re: Remove Workitem links within wiki

Postby thomas.boll » Mon Sep 14, 2015 1:42 pm

Hello Martin,

thank you for your answer. Now it works

regards
Thomas


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 3 guests