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.
Accepted answer
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.