Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get workietm type field value?

Hi,

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.

https://jazz.net/forums/viewtopic.php?t=24856&highlight=

0 votes



5 answers

Permanent link
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());

output:

Custom: customerid Customer ID workItem

0 votes


Permanent link
Hi sam,

its correct.

But that doesn't return any values.

It return only null value.

Please suggest me any solution.

0 votes


Permanent link
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'

0 votes


Permanent link
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) {
e2.printStackTrace();
}

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

String sValue = "";

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

return sValue;
}

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

0 votes


Permanent link
I don't understand.. Type is not an attribute..

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

from the javadoc

getWorkItemType

java.lang.String getWorkItemType()

Returns the work item type.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: May 21 '12, 2:35 a.m.

Question was seen: 4,929 times

Last updated: May 21 '12, 2:35 a.m.

Confirmation Cancel Confirm