Delete Assignees via script

Posts: 37
Joined: Mon Sep 29, 2014 7:00 pm

Delete Assignees via script

Postby DCwom » Mon Dec 29, 2014 7:22 pm

I'm trying to delete all assignees of a WI and assign the author as the only assignee. The following code works to add the author but only partially works with the deletion of old assignees.

Code: Select all

var workItem = workflowContext.getWorkItem();
var authorName = workItem.getAuthor().getName();    // String For comment
var authorObj = workItem.getAuthor();            // Object to set assignee

var assigneeList = workItem.getAssignees();
for (var i = assigneeList.iterator(); i.hasNext();) {
   var oldAssignee =;
workItem.addAssignee(authorObj);               // Add the author as an assignee

var returnvalue = "";
var title =  "Auto-assigned to " + authorName + " " + Z1;
var comment = "This WI has been auto-assigned to the author, " + authorName + ", because it has been resolved.";


Something just isn't right with the returned list of assignees and how I'm trying to unload the list, I'm not sure why the iterator isn't working with the returned IPObkectList. If I have two existing assignees it only removes 1 and if I have three it won't compile.

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

Re: Delete Assignees via script

Postby martins » Fri Jan 02, 2015 7:51 am

Hello Dennis,

you could use method "clear()" on the IPObjectList of workItem.getAssignees().

Code: Select all


Kind regards


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 15 guests