It's all about the answers!

Ask a question

How to set values in Workitem List attribute using server API

Pallavi Deore (3818) | asked May 29 '18, 8:11 a.m.


I am Using CLM 5.0.1
I am able to access and set work item list attribute value using server java API.
But if attribute of type work item list is already having some work items and i need to add one more work item in it using server java API. How to do it?

Any idea??

Accepted answer

permanent link
Luca Martinucci (1.0k285109) | answered May 30 '18, 2:40 a.m.

I've recently done that (in CLM 6.0.3), it is straightforward.

Basically, these are the steps:
  1. get the current value of the WI List attribute, as a List object;
  2. get the work item you want to add, as a IWorkItem object;
  3. add the work item to the List, using the add method;
  4. set the List as the new value of the attribute, using the setValue method (see the examples provided by Ralph):
  5. save the work item that contains the attribute you've updated (using the saveWorkItem3 method in the examples).
According to your post, you should already be able to perform steps 1, 4 and 5, and step 3 is very simple.
Just retrieve the work item you want to add to the list.

Pallavi Deore selected this answer as the correct answer

One other answer

permanent link
Ralph Schoon (61.8k33643) | answered May 29 '18, 8:25 a.m.
edited May 29 '18, 8:28 a.m.

The server API works exactly like the client API in most of the areas. Here how to save in the server API:

A list attribute is a List and the interface provides an add to add the data that is missing.So you make sure the list contains that it is supposed and then save, I think. See

Your answer

Register or to post your answer.