It's all about the answers!

Ask a question

How to read Custom Attributes of an RTC Work item using java

Vaibhav S (106245) | asked Sep 29 '21, 8:58 a.m.

 Hello all,

I need to read Custom Attributes of an RTC Work item using java.

For DNG we have a method as requirement.getExtendedPropoerties for this, for RTC Work Item i couldn't find the method. 

workItem.getCustomAttributes() method did not return the required results.

If anyone has done this, please let me know.


2 answers

permanent link
Luca Martinucci (1.0k294112) | answered Sep 29 '21, 10:05 a.m.

Using server side Java API, you can retrieve a custom attribute, provided that you know the attribute ID.

The getCustomAttributes() method returns the list of all custom attributes, then you loop over them and check the attribute ID.
This code snippet I developed used to work for me:

IAttribute attribute = null;
List<IAttributeHandle> attributesHandles = new ArrayList<IAttributeHandle>();
attributesHandles = workItemToCheck.getCustomAttributes();
Iterator<IAttributeHandle> attributesHandlesIterator = attributesHandles.iterator();
if (attributesHandlesIterator!=null) {
while (attributesHandlesIterator.hasNext()) {
IAttributeHandle currentAttributeHandle =;
IAttribute currentAttribute = (IAttribute) this.repositoryItemService.fetchItem(currentAttributeHandle, IRepositoryItemService.COMPLETE);
String currentAttributeID = currentAttribute.getIdentifier();
if (currentAttributeID.equalsIgnoreCase(attributeID)) {
attribute = currentAttribute;

Vaibhav S commented Sep 30 '21, 8:49 a.m.

 Hello Luca,

Thanks for the help here. really appreciate.

Can you please help me with one more thing: How did you initialize repositoryItemService variable? 

I tried declaring it as IRepositoryItemService repositoryItemService ; and using it as in your code, but it gives me null value.

please let me know how you initialized this variable.

Thanks again

Ralph Schoon commented Sep 30 '21, 9:00 a.m.

Because your question is lacking details Luca provides example code for a server extension. I a server extension you extend AbstractService and then you have getService(Servide.class) to get it. 

There is no realistic chance for you to implement a server extension if you do not follow the RTC Extensions Workshop. 

Since you provide no context, I would assume that you likely do not want to create a server extension. Maybe some automation, who knows. You can read and understand what you could do and provide more context. Otherwise I am pretty sure, this is not leading anywhere. If you want to use any Java API you should perform the RTC Extensions Workshop, at least the full lab1 to get a dev environment.

permanent link
Ralph Schoon (63.0k33645) | answered Sep 30 '21, 2:54 a.m.

 It is unclear what API is meant at all. The comparison to DNG does not make sense, as there is no Java API for it.....

If the question refers to the Plain Java Client Libraries or the EWM/RTC SDK, explains how to work with work item attributes. The post also links to others explaining how to setup your environment to support development. Although everyone seems to ignore the advice, it is best to perform the RTC Extensions Workshop at least LAB 1 completely to get a working development environment. Setting up the SDK is key, also for developing for the Plain Java Client Libraries.

Your answer

Register or to post your answer.