It's all about the answers!

Ask a question

How to get workitem type attribute field value?


pugazhenthi samidurai (26423742) | asked Mar 20 '12, 4:28 a.m.
Hi,

i have developed java script custom report for showing work items. Its working fine.

But i want to show the work item type field (attribute) value in my report.

could any one suggest me where/which snapshot/table its resides.


Thanks ,

Pugazh

One answer



permanent link
pugazhenthi samidurai (26423742) | answered Oct 03 '12, 8:17 a.m.
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;
    }

Your answer


Register or to post your answer.