It's all about the answers!

Ask a question

How to copy a work item and create a new work item from RTC participant ?


Nagendra Prasad (175) | asked Nov 19 '18, 4:03 a.m.

 Hi, I am working on a project where i have to create exact copies of the work item when save button is clicked. I understand that it needs to be done through a participant. Please help me out with the server APIs to get this done. Any help is much appreciated.


I have tried below link and there's no code sample, seems like it was removed.

Thanks in advance.

Accepted answer


permanent link
Ralph Schoon (63.5k33646) | answered Nov 20 '18, 2:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Several participant examples can be found here https://rsjazz.wordpress.com/?s=participant&submit=Search

More related api is here:https://rsjazz.wordpress.com/?s=work+item+attributes&submit=Search I am not sure there is a duplicate work item in the common or server API so you could readily use it. You can search the SDK though.

You can iterate the attributes and copy them/set the attribute in the copy relatively easily, if the work items are all in the same project area though.

Nagendra Prasad selected this answer as the correct answer

Comments
Nagendra Prasad commented Nov 20 '18, 5:08 a.m.

Thanks much for the answer and links Ralph, they were pretty useful. Is there a server API that returns list of all attributes of a work item ? There's workItem.getCustomAttributes() which returns custom attribute list, but i'm interested in all the attributes of a work items in particular. I saw an example of getting built-in attributes from a project area, but that's too much for a loop!


Ralph Schoon commented Nov 20 '18, 6:19 a.m. | edited Nov 20 '18, 6:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

See https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ section

Getting the Work Item's Attributes in the API

Check the IWorkItem and the IWorkItemCommon interfaces. Why would handling all attributes be too much for a loop? If you want to copy everything, you need to iterate everything.


Nagendra Prasad commented Nov 21 '18, 1:20 a.m.

We have close to 200 attributes in the project area. I'm guessing that iterating everything will take a toll on the performance.


1
Ralph Schoon commented Nov 21 '18, 2:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am at a loss why anyone wants 200 attributes in a project area. There seems to be a serious "customize to death" issue with some of the deployments. This is also likely impacting the performance already.


Nagendra Prasad commented Nov 21 '18, 4:12 a.m.

Ha ha, you're right. We're undergoing a simplification process already. Anyhow, thank you for your inputs, i've got enough information to take off.

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.