Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to display attribute value in work item editor.

Hi All,
I am using setValue(IAttribute attribute, Object value) method to set value of attribute of work item.
Value is set to attribute. I verified it using getValue(IAttribute attribute) method but it is not displayed in work item editor.
 I am creating operation participant for work item save operation. When work item is saved i am expecting to see value of attribute as set using setValue method, but nothing is displayed in work item editor in the text field of attribute.

0 votes



One answer

Permanent link
If you talk abut the server side Java API to set the value of an attribute in an operation participant, please note that just doing set value does not trigger any work item save operation at all.

You have to save the work item in the operation participant if you want to change its value. Please also note, that if you save a work item in a participant for work item save. If you don't take precaution this will trigger your participant again and..... the server will die in a recursive call crash.

See https://rsjazz.wordpress.com/?s=participant for several examples you should look at to get started.

See https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ in case you haven't already.

0 votes

Comments

I am using server side java API to set value of an attribute
Following is my code snippet

IWorkItem sourceworkItem = (IWorkItem)auditable;
IProjectAreaHandle projectArea = sourceworkItem.getProjectArea();
IWorkItemCommon workItemCommon = (IWorkItemCommon)getService(IWorkItemCommon.class);
IAttribute changerequest = workItemCommon.findAttribute(projectArea, "cr", monitor); //cr is attribute id
String value = new String("one");
if (sourceworkItem.hasCustomAttribute(changerequest))
   {
      sourceworkItem.setValue(changerequest,value);
    }

Value is not shown in work item editor.

Yes, because you don't save the work item after setting the value. My best advise is to actually ready my answer and then read the related blog posts, because they explain all that. That is the reason that I do them:

  1. To share with users that are interested to learn
  2. So that I don't have to paste the same text in questions here

So see https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and https://rsjazz.wordpress.com/?s=participant

You will also need to get a workingcopy for the work item, because if you try to save this workmitem you will get an Exception saying the work item is immutable. Again explained in https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,939

Question asked: Jul 16 '15, 7:41 a.m.

Question was seen: 2,634 times

Last updated: Jul 16 '15, 9:59 a.m.

Confirmation Cancel Confirm