Change Custom Field

Posts: 6
Joined: Fri Jul 22, 2016 11:19 am

Change Custom Field

Postby Lutz » Fri Jul 22, 2016 11:26 am


I want to change a custom field of a workitem inside of a wiki page with apache velocity.
I get the list with the workitems with the following coder:

Code: Select all

 #set($query = $trackerService.queryWorkItems("type:$itemType AND$", "id"))
 #foreach ($item in $query)

The content of the filed is rich text (text/html). I tried to use the method setCustomField($field).
How can I create $field?

Code: Select all

#set ($field = "somestring")

doesn't work. I tried to load the field with getCustomField and modify the content. Unfortunately there are no methods which allow modification.

Has someone an example how to use setCustomField with rich text?

Thank you very much

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

Re: Change Custom Field

Postby martins » Tue Dec 06, 2016 8:55 am

Hello Lutz,

You have to tell the setCustomField function what type of content you like to write to the rich text field.

Within a hook script you do this either with

Code: Select all

workItem.setCustomField("myField",com.polarion.core.util.types.Text.plain("just plain text"));


Code: Select all

workItem.setCustomField("myField",com.polarion.core.util.types.Text.html("<b>bold</b> HTML text"));

I asume in wiki pages this works similar.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 9 guests