It's all about the answers!

Ask a question

How to update a custom attribute value of a workitem using server side API.

Sachin Nairy (5111320) | asked Sep 27 '13, 5:36 a.m.



I wrote a java server side API to update a custom attribute value of a workitem using below code, value is showing in console but value is not updating in work item.


public class NcbreleseClass extends AbstractService implements




      private IWorkItemCommon fWorkItemCommon;

      public void run(AdvisableOperation operation,

                  IProcessConfigurationElement participantConfig,

                  IParticipantInfoCollector collector, IProgressMonitor monitor)

                  throws TeamRepositoryException


                        Object data = operation.getOperationData();

                        ISaveParameter saveParameter = null;


                        if (data instanceof ISaveParameter)



                              fWorkItemCommon = getService(IWorkItemCommon.class);

                              saveParameter = (ISaveParameter) data;

                              IAuditable auditable = saveParameter.getNewState();

                              IWorkItem workItem = (IWorkItem)auditable;

                              String type = workItem.getWorkItemType();


                              if (type.equals("projectchangerequest"))


                      IProjectAreaHandle fprojectArea = workItem.getProjectArea();

                      //info is custom attribute

                      IAttribute infovalue = fWorkItemCommon.findAttribute(fprojectArea,"info",monitor);

                      String value = new String("Update"); 


                      Object crValue = workItem.getValue(infovalue);

                        String crstring = crValue.toString();


                              System.out.println("Info Value is updated...."+crstring);










Thanks & Regards

Sachin Nairy

Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Sep 27 '13, 6:05 a.m.
Sachin, shows how this can be done using the server API.
Sachin Nairy selected this answer as the correct answer

Sachin Nairy commented Oct 29 '13, 7:00 a.m.

Thanks Ralph, It is a good information which u shared. it helps a lot to understand rtc framework. if possible write some information about coding standard for rtc api which will help us to avoid server load while running plugin.

Ralph Schoon commented Oct 29 '13, 7:10 a.m.

I have posted what I know in my blog.

To reduce load reduce the attributes you load by using profiles. Also detect as quickly as possible if you have to do something and quit if not. Avoid complex searches if possible. But finally, if you have to do something, you have to do it. No way around it. You could only try to reduce load by using intelligent algorithms and things Java Provides such as hash maps etc.

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.