How to get workitem type attribute field value?
One answer
Hi,
check the following code to get Workitem type filed id and summary.
public String getWorkitemTypeFieldValue(IWorkItem workItem,String CustomStringAttributeID)
{
WorkItemResolverUtil resolver = new WorkItemResolverUtil();
IWorkItem Item = null ;
Object obj = null;
try {
obj = resolver.getAttributeValue(workItem,CustomStringAttributeID);
} catch (TeamRepositoryException e1) {
e1.printStackTrace();
}
if (obj instanceof IWorkItemHandle) {
try {
Item = resolver.resolveWorkItem((IWorkItemHandle) obj);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
}
String value = "";
if(Item!=null)
value = Item.getId() + Item.getHTMLSummary().getPlainText();
return value;
}
check the following code to get Workitem type filed id and summary.
public String getWorkitemTypeFieldValue(IWorkItem workItem,String CustomStringAttributeID)
{
WorkItemResolverUtil resolver = new WorkItemResolverUtil();
IWorkItem Item = null ;
Object obj = null;
try {
obj = resolver.getAttributeValue(workItem,CustomStringAttributeID);
} catch (TeamRepositoryException e1) {
e1.printStackTrace();
}
if (obj instanceof IWorkItemHandle) {
try {
Item = resolver.resolveWorkItem((IWorkItemHandle) obj);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
}
String value = "";
if(Item!=null)
value = Item.getId() + Item.getHTMLSummary().getPlainText();
return value;
}