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

Server Side Plugin : Given a workitem, How to get the attribute's value ?

Hi Team,


I have to implement a server side Advisor, wherein for a particular workitem, i need to get the custom attribute's value and check if a particular text is present, if yes then allow to save the workitem else throw error.

Could you please share the code snippet for getting the attribute value. 

I have this code, but not helping me, I am unable to get the ITeamRepository in the plugin. However this is possible in Plain Java APIs Code.
List<IAttributeHandle> attrs = workitem.getCustomAttributes(); 
              for(IAttributeHandle attributeHandle : attrs) {
                IAttribute attribute = (IAttribute) ITeamRepository.itemManager().fetchCompleteItem(attributeHandle, IItemManager.DEFAULT, null);
                Object attributeValue = workitem.getValue(attribute);

Thanks in Advance.



0 votes


Accepted answer

Permanent link

The ITeamRepository is a client concept that does not exist in the server API. In the server API you use special services such as IWorkitemCommon or IWorkitemService etc.

See https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and other preconditions and follow up actions on my blog. 

Shwetha G selected this answer as the correct answer

2 votes

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,950
× 7,505
× 1,335

Question asked: Dec 02 '24, 7:50 a.m.

Question was seen: 212 times

Last updated: Dec 02 '24, 10:28 a.m.

Related questions
Confirmation Cancel Confirm