It's all about the answers!

Ask a question

How to set the default value for Planned for attribute using java


Surender Biyyala (401548) | asked May 11 '14, 12:18 a.m.
edited May 12 '14, 4:02 a.m. by Sreerupa Sen (1.0k4)
 Hi All,

The following is my scenario.

I want to set "Unassigned" value to Planned for attribute when the work item is rejected.

When I tried to Loop the iteration I`m able to get only the user defined values but not the deafult value i.e., Unassigned.

My Question is

How to set The Planned for attribute to Unassigned.

One answer



permanent link
Surender Biyyala (401548) | answered May 11 '14, 5:23 a.m.
 The following is the code snippet for setting the default value fro Planned for attribute

IAttribute plannedforAttribute = workItemServer.findAttribute(workItem.getProjectARea(),IWorkItem.TARGET_PROPERTY,monitor);
the above code is to get the handle for the Planned for Attribute 

IWorkItemCopy workItemCopy = (IWorkItem)workItemServer.findworkItemById(workItem.getId(),IworkItem.FULL_PROFILE,monitor).getWorkingCopy);
This is to get the copy of the current work item which is being saved.

workItemCopy.setValue(plannedForAttribute,null);
workItemServer.saveWorkItem3(workItemCopy,null,null,additionalparameters);

Your answer


Register or to post your answer.