It's all about the answers!

Ask a question

How to update rank of multiple work items ?


Naveen Arora (3178) | asked May 21 '12, 4:27 p.m.
Hi

Is there anyway to massively update the rank of multiple work items? Or is dragging and dropping the work items in the backlog plan the only option?

Can the massive update be done in a programmatic way ? The solution does not have to involve Excel. I will consider any option.

Regards
Naveen

3 answers



permanent link
Ralph Schoon (63.1k33646) | answered May 24 '12, 2:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Lee,

the article https://jazz.net/library/article/807 talks about using the plain Java Client Libraries.

https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation talks about programmatic work item creation. There is a code example to be used with the plain java client libraries.

If you use that as a starter and modify it you would change the WorkItemInitialization inner class to something like:


private static class WorkItemModification extends WorkItemOperation {

private String fAttributeID;
private Object fValue;

public WorkItemModification(String attributeID, Object value) {
super("Initializing Work Item");
fAttributeID=attributeID;
fValue=value;
}

@Override
protected void execute(WorkItemWorkingCopy workingCopy,
IProgressMonitor monitor) throws TeamRepositoryException {
IWorkItem workItem = workingCopy.getWorkItem();
ITeamRepository teamRepository = (ITeamRepository)workItem.getOrigin();
IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);

IAttribute attribute = workItemClient.findAttribute(workItem.getProjectArea(),
fAttributeID, null);
if(null!=attribute){
if(workItem.hasCustomAttribute(attribute))
workItem.setValue(attribute, fValue);
}
}
}


And call it like this:


int id = new Integer(idString).intValue();
IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.SMALL_PROFILE, null);
WorkItemModification operation = new WorkItemModification("anAttributeID","someValue");
operation.run(workItem, null);


I have not tested this code!
You need to look up the attribute ID for RankByPriority (if it exists as attribute), there is no direct setter.

permanent link
Lee Gemma Fu-Sun (6) | answered May 23 '12, 6:14 p.m.
Hi Ralph,

Thanks for the suggestion! I work with Naveen Arora. I tried to update ranks by importing them from Excel, but it did not work in our current RTC version 3.0.1.1. Could you please provide more information about the java client libraries that you mention in your post?

Thanks,

Lee Gemma Fu-Sun
CA technologies
APM Shared Services
Associate Configuration Management Engineer
Tel: +1-650-534-9555
Mobile: +1-415-335-5629
Gemma.Fu-Sun@ca.com

permanent link
Ralph Schoon (63.1k33646) | answered May 22 '12, 3:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
In general ranking is something manual, to provide a custom order in a plan. So it is a manual process. The attribute value is calculated by the plan.

In 4.0RC1 I was able to rank work items and create a query that displays the coumn "Rank (relative to priority)". The column values look like: priority.literal.l11 O00005

You could try (on a test system) to export to CSV, modify the rank and re-import with update. If that does not work the only chance I see is using the plain java client libraries and try to write a tool that modifies the rank, if possible.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.