WorkItem changing status
Hi, I'm trying to change a WorkItem status using a client side follow-up plugin. I get the working copy, set the action and save but no action seems to be triggered. I also try insert another modify action like modifing the description and it runs correctly.
This is my code:
I also get the status result of save operation and it gives me OK.
Can I have some help? What is my error?
Thanks.
This is my code:
String azione = "Start Working";
IWorkItemClient client = (IWorkItemClient)repo.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager WCManager = client.getWorkItemWorkingCopyManager();
WCManager.connect(wiHandle, IWorkItem.FULL_PROFILE, monitor);
WorkItemWorkingCopy wiCopy = WCManager.getWorkingCopy(wiHandle);
String oldContent = wiCopy.getWorkItem().getHTMLDescription().toString();
wiCopy.getWorkItem().setHTMLDescription(XMLString.createFromPlainText(oldContent+";CIAOO"));
wiCopy.setWorkflowAction(azione);
String out = wiCopy.getWorkflowAction();
IDetailedStatus status = wiCopy.save(monitor);
WCManager.disconnect(wiHandle);
I also get the status result of save operation and it gives me OK.
Can I have some help? What is my error?
Thanks.
Accepted answer
This shows a state change in a server follow up action: https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/ the code in the client should be similar. There are several client API examples on the blog.
Here is the link for how to trigger a build from a state change: https://rsjazz.wordpress.com/2016/07/15/build-on-state-change-work-item-save-participant/
4 other answers
Hi
You have to pass the id of an action to the workingcopy. To get the set of possible action ids for the current state of a work item, you can use IWorkItemClient#findWorkflowInfo and then WorkflowInfo#getActionIds. Passing one of these ids to the workingcopy should transition the workflow the to end state of that action (which can be accessed programatically using WorklfowInfo#getActionResultState.
Regards
Marcel
Jazz Work Item team
You have to pass the id of an action to the workingcopy. To get the set of possible action ids for the current state of a work item, you can use IWorkItemClient#findWorkflowInfo and then WorkflowInfo#getActionIds. Passing one of these ids to the workingcopy should transition the workflow the to end state of that action (which can be accessed programatically using WorklfowInfo#getActionResultState.
Regards
Marcel
Jazz Work Item team
Hi Michele,
Am in-between the process of creating custom workitem which will start build when it's staus will change, I have used java client API programs to request Build,Am able to do this by running as java application. But am not sure how to use this in workitem, how to create an custom workitem to invoke it. could you please help me to sort out.