It's all about the answers!

Ask a question

WorkItem changing status


Michele Pegoraro (1.8k1210398) | asked Jul 14 '09, 7:25 a.m.
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:

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


permanent link
Ralph Schoon (54.4k13641) | answered Jun 27 '18, 9:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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/

Ralph Schoon selected this answer as the correct answer

4 other answers



permanent link
Michele Pegoraro (1.8k1210398) | answered Jul 14 '09, 8:43 a.m.
I've notice that it currently does something, because if I try to set action Resolve from In Progress status (referring to Eclipse Way Default workflow) it moves work item state to New instead of Resolved.
Any help?

permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Jul 14 '09, 9:08 a.m.
JAZZ DEVELOPER
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

permanent link
Michele Pegoraro (1.8k1210398) | answered Jul 14 '09, 10:34 a.m.
Hi Marcel, thank you for your answer.
Really, I would have never thought that String as input parameter of getWorkflowAction method was a conversion from Id. I really had not understood. Thank you very much.

permanent link
Dhinesh Palanisamy (152) | answered Jun 27 '18, 8:34 a.m.

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. 

Your answer


Register or to post your answer.