-->

How to find work item filed against category value

2019-06-04 02:08发布

问题:

I am using below code and found filed against category object but there I am not able to find the value. Please help.

IProjectAreaHandle projectAreaHandle = workItem.getProjectArea();

                IAttribute someAttribute = workItemClient.findAttribute(projectAreaHandle, IWorkItem.CATEGORY_PROPERTY,
                        monitor);



    IAttributeHandle iAttributeHandle = (IAttributeHandle) someAttribute;
                    IAttribute iAttribute = (IAttribute) repo
                        .itemManager().fetchCompleteItem(
                        iAttributeHandle, IItemManager.DEFAULT ,monitor);

                    Object value = workItem.getValue(iAttribute);

回答1:

Below code will help to find out the filed against attribute value :

 ICategoryHandle iCategoryHandle = workItem.getCategory();
                ICategory iCategory1 = (ICategory) repo
                        .itemManager().fetchCompleteItem(
                                iCategoryHandle, IItemManager.DEFAULT ,monitor);
                return iCategory1.getName();