1

im trying to get all work items whose status has changed from "created" to "in progress" in the last seven days.

This is my current query:

"type:arbeitspaket and updated:[$today-7d$ TO $today$] AND status:inBearbeitung"

Is it possible to get work itemes where only the status field updated from "created" to "in progress"?

2 Answers2

0

Polarion does not support queries to historical data. So it is not possible to ask Polarion via Lucene-query when a field changed its value.

You can search through history via API, but this is a potential performance hole: The API will always return the complete history of the item in question. If you have 10000 commits on it, you will receive 10000 entries in a list (which you need to search through).

However, for status changes there is an easy workaround: you can use the workflow actions to auto-fill dates and previous states (or anything else) into hidden custom fields. Then you can query those fields.

There is a build-in function called Changed Field documented here to record the date.

Peter Parker
  • 29,093
  • 5
  • 52
  • 80
0
Below script shows how to retrieve the history
Velocity API

#set($modifiedWIinLastdays = $trackerService.queryWorkItems("updated:[$today-7d$ TO $today$]", "id" )
#set($ignoreFields =[<<type in all custom field ids expect status>>])
 
#foreach($workItem in $modifiedWIinLastdays)
#set($workItemHistory=$workItem.getDataSvc().getDiffManager().generateHistory($workItem, $ignoredFields))
#foreach ($change in $workItemHistory)
    #set ($diffs = $change.getDiffs())
    #foreach ($diff in $diffs)
      #if ($diff.getFieldName().equals("status"))
        #if ($diff.getAfter().getId().equals("inProgress"))
            <<your result>>
        #end
      #end
     #end
#end