Exporting Work Items via IExportManager

Posts: 5
Joined: Mon Feb 19, 2018 12:13 pm

Exporting Work Items via IExportManager

Postby natasia0603 » Mon Jun 24, 2019 2:18 pm


Today the following steps must be done manually:
  • display filtered list of Work Item
  • press cogwheel button and select export
  • choose correct excel export template
  • export the work items

Instead, I want to create a button (at a dashboard), which allows to automatically (display and) export the filtered list with the correct excel export template.

Displaying the correct filtered list is not the problem, but how to start the export routine with a dedicated template?

Last edited by natasia0603 on Thu Jun 27, 2019 2:08 pm, edited 1 time in total.

Posts: 5
Joined: Mon Feb 19, 2018 12:13 pm

Re: Button for exporting Work Items with correct Template

Postby natasia0603 » Thu Jun 27, 2019 2:08 pm


from this post: http://forums.polarion.com/viewtopic.php?t=97944, I believe it must be something like this. But I can't get it working. My debug alert does not pop up...

Any ideas?

Code: Select all

function myFunction() {
   var em = trackerService.getExportManager();
   var exportDescriptor = em.getExporterDescriptor(com.polarion.alm.tracker.exporter.IExportManager.EXP_EXCEL_ROUND_TRIP);

<button onclick="myFunction();">Test</button>

Posts: 78
Joined: Wed Mar 07, 2018 1:06 pm
Location: Germany

Re: Exporting Work Items via IExportManager

Postby SteffPoint » Mon Jul 01, 2019 10:42 am

Hello Jenny,

I have created a Workflow-Script for exporting Work Items.

Following lines from my script may be interesting to you:

Code: Select all

var project = "YOURPROJECTID";

var reqsToConsider = trackerService.queryWorkItems("project.id:YOURPROJECTID AND NOT type:heading", "id");

var exportManager = trackerService.getExportManager();

var exportDescriptor = exportManager.getExporterDescriptor(com.polarion.alm.tracker.exporter.IExportManager.EXP_EXCEL_ROUND_TRIP);

var charSet = null;

var fields = ["type", "status", "element_id" , "module", "project", "id"];

var exportTemplate = exportManager.getTemplate(exportDescriptor, "NAMEOFYOURTEMPLATE.xlsx", trackerService.getProjectsService().getProject(project).getContextId());

var params = null;

var conf = new com.polarion.alm.tracker.exporter.TableExportConfiguration(reqsToConsider, "project.id:" + project + "\xa0AND NOT type:heading", charSet, fields, exportTemplate, params);


var exporter = exportManager.startExport(exportDescriptor, conf);

Please do mind: I have used the script in a post-save context. That means for example the trackerService is already available (I don't have to call it). I don't know if in your context you will first have to call it (for example via the ICallContext: https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/tracker/workflow/ICallContext.html).

Kind Regards,

Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Bing [Bot] and 14 guests