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

How to get work item type attribute value?

Hi,

I am using the below function to retrieve work item type attribute 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 attribute.

0 votes



One answer

Permanent link
Your code looks OK to me.
You should check if the work item actually has the custom attribute and a value for it.

See:
https://jazz.net/forums/viewtopic.php?p=79043
https://jazz.net/forums/viewtopic.php?p=68390

You might have to run "synchronize attributes" to make sure all work items have the attribute. The other area to look at is the load profile for resolving/loading he work item. Not sure if you would get a value if you load with the SMALL_PROFILE.

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 22 '12, 12:46 a.m.

Question was seen: 5,196 times

Last updated: May 22 '12, 12:46 a.m.

Confirmation Cancel Confirm