It's all about the answers!

Ask a question

How to set a work item's QA Team and Phase Found using RTC Plain Java API?

cheng yingying (324) | asked Nov 28 '14, 2:58 a.m.
edited Nov 28 '14, 3:50 a.m.

According to posts in this forum, I should use following code to set QA Team and Phase Found.

IAttribute qaAttribute = workItemClient.findAttribute(projectArea, "qa_team", null);

IAttribute phaseAttribute = workItemClient.findAttribute(projectArea, "howfound", null);

workItem.setValue(IAttribute, Object);

But My Question is:

If I have known the QA Team's name(For example, FVT), and PhaseFound's name(For example, Phase 1), how to get those objects which would be used by workItem.setValue(...)?

Which class and method should I use to get the corresponding objects. I want to know how to write the code as below:

IAttribute foundInAttribute = workItemClient.findAttribute(projectArea, "foundIn", null);
IDeliverable foundIN = workItemClient.findDeliverableByName(projectArea, foundIn,
     IDeliverable.SMALL_PROFILE, null);

Of course, other implementation is welcome.

Thanks in advance.


These two attributes might be customized attributes:

displayName: QA Team
attributetype: test_team
identifier: qa_team

displayName: Phase Found
attributetype: HowFound
identifier: howfound

Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Nov 28 '14, 4:24 a.m.
It is unclear what type is used for these attributes. I assume it is an enumeration. If this is the case, look here
cheng yingying selected this answer as the correct answer

cheng yingying commented Nov 30 '14, 10:28 p.m.

Thanks for your help, Ralph. It really helps!

3 other answers

permanent link
cheng yingying (324) | answered Nov 30 '14, 10:28 p.m.
And I have a subsequent question. I've got following error when I have set values and save a defect work item. I have the permission to create a defect from UI. Does the following error mean I don't have the permission to create a defect by API? Thanks. : CRJAZ6053E The 'Save Work Item' operation cannot be completed. Permission is required to complete the operation.
      at )

Name: Save Work Item
      Severity: ERROR
            Name: Required Properties
            Severity: OK
            Name: Required Approvals
            Severity: OK
            Name: All Children Resolved
            Severity: OK
            Name: Save Project Area
            Severity: ERROR
                  Summary: Permission Denied
                  Description: You don't have permission to perform the following actions:
  Modify the process specification (modify/specification)
                  Severity: ERROR
                  Name: Avoid saving private roles
                  Severity: OK

permanent link
sam detweiler (12.5k6195201) | answered Nov 30 '14, 10:57 p.m.
Looks like you are trying to save the project area.. not just the workitem


permanent link
cheng yingying (324) | answered Dec 01 '14, 12:47 a.m.
edited Dec 07 '14, 8:57 p.m.
Thank you, Sam.

I believe I'm saving a work item(defect), don't know why it triggered the saveProjectArea. Following is the related code. And I have used the similar code to save a work item(task) successfully. Confused.

private static class WorkItemInitialization extends WorkItemOperation {
private String fSummary;
private ICategoryHandle fCategory;
private IIterationHandle fIteration;
HashMap<IAttribute, Object> fAttributes;
public WorkItemInitialization(String summary, ICategoryHandle category, IIterationHandle iteration, HashMap attributes) {
super("Initializing Work Item");
fSummary= summary;
fCategory= category;
fAttributes = attributes;
fIteration = iteration;
protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {
IWorkItem workItem= workingCopy.getWorkItem();

Iterator keys = fAttributes.keySet().iterator();
IAttribute key = (IAttribute);
Object value = fAttributes.get(key);
workItem.setValue(key, value);

String repositoryURI= "";//    
String userId= "XXX";
String password= "XXX";
String projectAreaName= "Lotus Connections";
String typeIdentifier= "defect";

String summary = "Post install bvt";
String categoryName= "Web/Cross Functional/Automation";//args[6];//filedAgainst
String plannedFor = "Main development/Release Backlog/2014 Development";//required by task, defect
String foundIn = "Automated BVT";//required by defect
String qaTeam = "Functional (FVT)";//required by defect
String phaseFound = "Functional (FVT)";//required by defect
IWorkItemType workItemType= workItemClient.findWorkItemType(projectArea, typeIdentifier, null);
if (workItemType == null) {
System.out.println("Work item type not found.");
return false;

IAttribute phaseAttribute = workItemClient.findAttribute(projectArea, "howfound", null);
Identifier literalID_phase = null;
IEnumeration enumeration_phase =workItemClient.resolveEnumeration(phaseAttribute, null);
List literals_phase = enumeration_phase.getEnumerationLiterals();
for (Iterator iterator = literals.iterator(); iterator.hasNext();) {
ILiteral iLiteral = (ILiteral);
if (iLiteral.getName().equals(phaseFound)) {
literalID_phase = iLiteral.getIdentifier2();
System.out.println("You found phase!!");
System.out.println("not found phase");
return false;
attributes.put(foundInAttribute, foundIN);
attributes.put(qaAttribute, literalID);
attributes.put(phaseAttribute, literalID_phase);

WorkItemInitialization operation= new WorkItemInitialization(summary, category, cih, attributes);
IWorkItemHandle handle=, null);
IWorkItem workItem= auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null);
System.out.println("Created work item " + workItem.getId() + ".");

Your answer

Register or 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.