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=
i am using plain java client for fetching all work items.
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=
5 answers
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
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'
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'
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.
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();
}
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.