Page 1 of 1

Wiki page - find a custom field value

Posted: Thu Nov 30, 2017 10:42 am
by JulienE
Hi there,

I have a workitem (id: "fonction") with a custom field (id: "idQC").

In a classic wiki page, I would like to find the value of the custom field idQC and write it in a variable, to be able to reuse it later.

How can I achieve this?

Here is a first step I've made:

Code: Select all

#set ($project_id = $page.getSpace().getProjectId())

#set($items = $trackerService.queryWorkItems("type:fonction AND project.id:$project_id", "id"))

#foreach($item in $items)
   #set ($itemID = $item.getId())
   #set $itemidQC = ???????????????????????????????????
##end


Maybe it is not the right direction. I can get the ID of the item, but I don't know how to get the value of its custom field.

Thanks for your help and answers.

Best,

Re: Wiki page - find a custom field value

Posted: Tue Dec 19, 2017 2:20 pm
by ALMighty
Hello!

This is done by

Code: Select all

 #set ($itemID = $item.getId())
 #set $itemidQC = $item.getCustomField("idQC")


Here you can find the Javadoc of the WorkItem class : https://almdemo.polarion.com/polarion/s ... kItem.html
(this is for the Polarion ALM only, for the API which you can invoke in Java of the ALM you can find it here)

by the way you have written
I have a workitem (id: "fonction") with a custom field (id: "idQC").


But you actually meant type: fonction (see your query). :wink: