It's all about the answers!

Ask a question

How to get workietm type field value?

pugazhenthi samidurai (26423942) | asked May 21 '12, 2:35 a.m.

i am using plain java client for fetching all work items.

More over i have found all the field values for each work item(ex. state , priority , contributor type , Summary .. etc).

But i am unable to fetch the value of work item type field.

Please look my previous post for more information.

5 answers

permanent link
sam detweiler (12.5k6195201) | answered May 21 '12, 8:59 a.m.
from your prior post. I think the text 'customerid' is the workitem 'type'

check my output below for this line,

System.out.print("Custom: " +customString.getIdentifier()+" \t" +customString.getDisplayName()+" \t"+customString.getAttributeType());


Custom: customerid Customer ID workItem

permanent link
pugazhenthi samidurai (26423942) | answered May 21 '12, 9:25 a.m.
Hi sam,

its correct.

But that doesn't return any values.

It return only null value.

Please suggest me any solution.

permanent link
sam detweiler (12.5k6195201) | answered May 21 '12, 10:51 a.m.
sorry, I am confused..

I think I see three outputs if you change your code like this(adding single quotes to the literals in the message format)

System.out.print("Custom: '" +customString.getIdentifier()+"' \t'" +customString.getDisplayName()+"' \t'"+customString.getAttributeType()+"'");

Custom: 'customerid' 'Customer ID' 'workItem'

workItemType represents the arbitrary string u defined in the project config. that string is returned by 'getIdentifier()' not getType().
getType() is 'workitem'

permanent link
pugazhenthi samidurai (26423942) | answered May 22 '12, 12:44 a.m.
Hi sam,

I am using the below function to retrieve work item type value.

But it doen't return any value.

public static String getWorkitemTypeFieldValue(IWorkItem workItem,String fCustomStringAttributeID)

ITeamRepository repository = RepositoryManager.getInstance().getCurrentRepository();

IWorkItemClient workItemClient = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);

IAuditableCommon iac = workItemClient.getAuditableCommon();

IProgressMonitor monitor = new NullProgressMonitor();

IProjectArea projectArea = null;
try {
projectArea = getReportOneProjectArea();
} catch (TeamRepositoryException e2) {

IAttribute customString = null;
try {
customString = workItemClient.findAttribute(projectArea, fCustomStringAttributeID, null);
} catch (TeamRepositoryException e) {
Object value = workItem.getValue(customString);

String sValue = "";

if(value!=null && value instanceof String) {
sValue = (String) value;
System.out.print("\tValue: " + sValue);

return sValue;

Let me know is there any other way to get the value of work item type field.

permanent link
sam detweiler (12.5k6195201) | answered May 24 '12, 9:20 a.m.
I don't understand.. Type is not an attribute..

so workitem.getWorkitemType() should return the value you seek.

from the javadoc


java.lang.String getWorkItemType()

Returns the work item type.

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.