You are not logged in. Click here to log in.

codebeamer Application Lifecycle Management (ALM)

Search In Project

Search inClear

Tags:  not added yet
Since codeBeamer 7.2.0 the Word export can optionally export the history of Work Items. The output of this kind of export is very similar to what you see on the "History" tab of the Work Items and should be suitable in most cases.

Sometimes however you may want to customize how the History is exported. This can be achieved by adding some custom code to your Word templates. For example this Velocity scriptlet will render the History entries to one row like this:

The complete example Word document is attached to here: CB:/displayDocument/custom-history.docx?doc_id=766769

The relevant part of the script, see comments to get better understanding of what's going on here:

## Render item/issue/requirement’s history if selected on the export GUI
#if (${exportOptions.exportItemHistory})
<div class=”exportItemHistory”><b>History:</b><br/>
#set($historyRenderer = $springDispatcherServletContext.getBean(“trackerItemHistoryTableRenderer”))
## call the original history rendering, because this will populate the model and put the data-objects to the request
#set($hist = $!{historyRenderer.renderTrackerItemHistory($request, $user, $requirement)})

## Custom history rendering goes here
## The $historyRenderer above has collected the history objects and those are in the request here:
#set($itemHistory=$request.getAttribute(“itemHistory”))
<table>
<tr><th>Submitter</th><th>Date</th><th>transition</th><th>field</th><th>Old value</th><th>New value</th></tr>
#foreach ($history in $itemHistory)  ## $history now is a TrackerItemRevisionDto
#set($first = true)
#set($changes = $history.changes)    ## each property change is a TrackerItemHistoryEntryDto
#set($rowspan = $changes.size())
   #foreach ($change in $changes)
<tr>
#if ($first)
   <td rowspan=”${rowspan}”>#if($first) $!{history.submitter.name} #end</td>
   <td rowspan=”${rowspan}”>#if($first) $!{history.submittedAt} #end</td>
   <td rowspan=”${rowspan}”>#if($first) $!{history.transition}#end </td>  ## this is a WorkflowTransitionDto
#end
   <td>$!{change.fieldName}</td>
   <td>$!{change.oldValue}</td>
   <td>$!{change.newValue}</td>
</tr>
#set($first = false)
  #end
#end
</table>

</div>
#end