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

How to get and update the status of the work item via Java API?

 IWorkItem workItem .....;

            IWorkItemHandle handle = (IWorkItemHandle) workItem.getItemHandle();

            IWorkItemWorkingCopyManager wcm = workItemClient
                    .getWorkItemWorkingCopyManager();
            wcm.connect(handle, IWorkItem.FULL_PROFILE, null);

            WorkItemWorkingCopy wc = wcm.getWorkingCopy(handle);

            IWorkItem copiedWorkItem = wc.getWorkItem();

 IAttribute statusAttribute= workItemClient.findAttribute(projectArea, IWorkItem.STATE_PROPERTY, monitor);

 IWorkflowInfo workflowInfo = workItemClient.findWorkflowInfo(copiedWorkItem,  monitor);
            String currentStatus = workflowInfo.getStateName(copiedWorkItem.getState2()); // I have gotten the current status of the work item.

Now I want to change the status but failed via either of the following two ways.
Way 1: 
 wc.setWorkflowAction("In Progress");
Way 2:
 Identifier <IState> [] allStatus = workflowInfo.getAllStateIds();
copiedWorkItem.setState2(allStatus[2]);

Seems I used the right API but the status was not changed on RTC.

1

0 votes

Comments

Have you saved the workitem ( saveWorkItem2 or saveWorkItem3) ?  I don't see the code in the list.




One answer

Permanent link
There is blog article written by our colleague.

  http://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/

There is a sample code in the middle of the blog entry. I recommend to subscribe this blog as we will get notification of sample codes !



0 votes

Comments

 Takehiko,


I am not sure your total thinking. Who will call saveWorkItem2 or saveWorkItem3? 
Can you paste your code here?

If you are in China, Wordpress is blocked in China, you can try http://rsjazz.wordpress.com.nyud.net instead, it has worked for some people.

The code I use to find the state is downloadable here: http://dl.dropbox.com/u/12668004/UpdateParentParticipants/20121127_UpdateParentParticipants.zip

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
× 1,700

Question asked: Mar 11 '13, 11:55 p.m.

Question was seen: 8,380 times

Last updated: Mar 12 '13, 2:20 a.m.

Confirmation Cancel Confirm