How to move a Work Item to Close State programmatically
Hi,
I have been trying to move a Work Item to Close State programmatically but couldnt succeed. Can anyone help on this? Thanks in Advance, Vijay |
8 answers
Hi, Below is how I currently do it. I am positive there is a better way but I haven't figured it out yet. Hopefully someone from the Jazz team will respond.
|
Hi
The correct way to do a workflow transition is to use an action. The IWorkflowInfo has a method 'getResolveActionId' that return the id of the action that is configured in the process spec to be the 'Resolve Action'. If you however want the work item to be in a specific well-known state (e.g. state 'Closed'), you have to find a valid action leading from the current state of the work item to the desired one. If you have the action ID, you can then use WorkItemServer#saveWorkItem(IWorkItem workItem, String workflowAction) Regards Marcel Jazz Work Item team |
|
Hi, I have notice that saveWorkItem is depracated, and saveWorkItem2 have to be used instead. But this new method require a WorkItemReference object. What is it using for? |
Hi
WorkItemReferences are a wrapper around repository links. If you do not modify links from or to the work item, you can simply pass in 'null'. Regards Marcel Jazz Work Item team |
So, if I add or modify some links, can I retrieve WorkItemReferences using IWorkItemCommon.resolveWorkItemReferences from my WorkItem copy and then use it on saveWorkItem2 method togheter with WorkItem instance?
|
Hi
Yes, it should work that way. Regards Marcel Jazz Work Item team |
Do we have any article on this? Please share.
Thanks
|
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.