Page 1 of 1

modify WI within widget or WIKI page

Posted: Fri Mar 17, 2017 2:05 pm
by SemiOk
Hi,

i'm trying to manipulate WorkItems attached hyperlink. I have to replace a servername by another one.
I'm able to list up all the hyperlinks that should be modified.
To change the hyperlinc i'm using the following:

Code: Select all

  ##  allowed ?     
  #if (!$transactionService.canBeginTx())
    ##  - start transaction
    #set ($void = $transactionService.beginTX())
    ##  - remove old hyperlink
    #set ($void = $wi.removeHyperLink($hl.Uri) )
    ##  - modify Uri
    #set ($newUri = $hl.Uri.replace($oldText,$newText))
    ##  - add new hyperlink to WI
    #set ($void = $wi.addHyperlink($newUri, $hl.Role) )
    ##  - save WI
    #set ($void = $wi.save() )
    ##  - terminate transaction
    #set ($void = $transactionService.commitTx())
  #else
    no transaction allowed reload page
  #end ## transaction


This code used within a report page in a <Script block> the error "save() is not allowed within readonly transaction"

This code use within a old Wiki-page always prints "no transaction allowed reload page".

Has anyone a hint where the problem is? Is my user (or the one from the widget) missing some rights?

thanks