It's all about the answers!

Ask a question

Set RTC status/resolution together (Java API)

Alexander Kershaw (1323) | asked Jun 11 '14, 11:58 a.m.
edited Jun 12 '14, 2:49 a.m. by Ralph Schoon (63.2k33646)
I need to set the status/resolution of work items. I'm currently doing this the following way:

1) WorkItemWorkingCopy.saveWorkflowAction(String) to set the status
2) to save the status
3) IWorkItem.setResolution2(Identifier<IResolution>) to set the resolution

However, this does not work correctly since the resolution depends on the status.

For example: using the RTC GUI, I can select the correct status, and then the valid resolutions appear on the resolution drop-down. If I save the work item, the resolutions then disappear from the drop-down and only the selected one is there. So when using the above API methods, the work item is being saved with no resolution set, which makes it go to the default. The resolution setting is therefore not recognised and fails (with no error message - simply nothing happens). I cannot set the resolution before saving the status because then RTC does not recognise the selected status.

Using IWorkItem.setState2(Identifier<IState>) works, but is deprecated. What is the current solution for this?

Accepted answer

permanent link
sam detweiler (12.5k6195201) | answered Jun 19 '14, 12:09 p.m.
edited Jun 20 '14, 2:03 p.m.
don't you want to use WorkFlowInfo.getResolutionIds(action)?

as the state hasn't changed yet, cause the save hasn't completed.
so you would want to get the potential resolutions for that action.

then u would use the getWorkitem() to be able to set the resolution.. (hm.. should be available thru the workingcopy, but you never know)
Alexander Kershaw selected this answer as the correct answer

Alexander Kershaw commented Jun 20 '14, 11:27 a.m.

That works - thanks!

One other answer

permanent link
Arne Bister (2.6k12832) | answered Jun 14 '14, 11:57 a.m.

looking at the way the internal tests of the RTC SDK do it, it would appear that this could work:

Identifier<IWorkflowAction> actionID ... ;
Identifier<IResolution> resolution ... ;
WorkItem workItem= (WorkItem) workingCopy.getWorkItem();

Does this work for you? If this answers your question, please mark it as accepted.


Alexander Kershaw commented Jun 19 '14, 11:42 a.m.

Hi Arne,

This isn't working - the same problem occurs.

The line:


seems to correctly set the internal workflowAction variable, but the line:

    WorkItem workItem= (WorkItem) workingCopy.getWorkItem();

returns a work item with the old state. Therefore an Identifier<IResolution>[] cannot be obtained.

My code for obtaining the available Identifier<IResolution>[] objects is:

    final Identifier<IState> wiState = workItem.getState2();
    final Identifier<IResolution>[] resolutions = workflowInfo.getStateResolutionIds(wiState);

This returns an empty array since it is going off the original state which had no available resolutions.

If the array would have contained the available resolutions, I would have used the IWorkflowInfo.getResolutionName(Identifier<IResolution>[]) method to find the desired one.

Do you have any ideas?


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.