It's all about the answers!

Ask a question

Updating multiple work items

Sarthak Sharma (4711620) | asked Aug 27 '12, 4:16 a.m.
edited Aug 27 '12, 4:34 a.m. by Ralph Schoon (63.3k33646)
If I have list of two or more workitems and I want to perform Save operation on all of them.
It is something like I have to set values from parent attribute to the same attribute in children.
How Can it be done ?

If I save 1 work item in the list then other work items in the list are lost as run() method is called again.

Please suggest something.
Thanks in advance.

2 answers

permanent link
Aradhya K (1.4k54345) | answered Aug 28 '12, 7:08 a.m.
Hi Sarthak
Do you have a adviser or participant which will update the parent work item on save of the child work item??
In that case if you try to save both parent and child then the parent save fail with stale data Exception.
You need to save all the children first then load the parent and update it and save.

Sarthak Sharma commented Aug 30 '12, 2:42 a.m.

I am doing it using participant and I am traversing all the children work items and then I am trying to save them using saveWorkItem2() method. But is going through only 1 work item repeatedly.

Sarthak Sharma commented Aug 30 '12, 2:43 a.m.

Basic requirement is to traverse up to the root work item(in the tree) and then saving all the children workitems according to some condition.

permanent link
Ralph Schoon (63.3k33646) | answered Aug 27 '12, 4:33 a.m.

I am not sure which run() method you refer to.

Dependent of the context you will have to run several save or modify operation.

On the server you can use saveWorkitem2() or saveWorkitem3() as used in

Using the client API you can use the same WorkItemOperation used in save

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.