Expressions - custom attribute
https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/
I want to get all workitems with custom value = 100;
Is it feasible ?
how ?
IAuditableCommon auditableCommon = (IAuditableCommon) teamRepository.getClientLibrary(IAuditableCommon.class); IQueryableAttribute attribute = QueryableAttributes.getFactory( IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.PROJECT_AREA_PROPERTY, auditableCommon, monitor); IQueryableAttribute type = QueryableAttributes.getFactory( IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.TYPE_PROPERTY, auditableCommon, monitor);Expression inProjectArea = new AttributeExpression(attribute, AttributeOperation.EQUALS, projectArea); Expression isType = new AttributeExpression(type, AttributeOperation.EQUALS, workitemTypeID); Term typeinProjectArea= new Term(Term.Operator.AND); typeinProjectArea.add(inProjectArea); typeinProjectArea.add(isType);
</pre>
Accepted answer
Note: this is a RTC question tag rational-team-concert . Jazz Foundation is totally different and few people know what it entails.
As far as I know you substitute the IWorkItem.TYPE_PROPERTY with the custom attribute ID. E.g. "id.of.my.custom.attribute".
IQueryableAttribute type = QueryableAttributes.getFactory( IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.TYPE_PROPERTY, auditableCommon, monitor);
E.g.
IQueryableAttribute type = QueryableAttributes.getFactory( IWorkItem.ITEM_TYPE).findAttribute(projectArea, "id.of.my.custom.attribute", auditableCommon, monitor);
It also helps when knowing how to search for examples in the SDK. See https://rsjazz.wordpress.com/2019/05/16/searching-and-exploring-the-rtc-sdk/
By the way, this is an SDK and the API is an application programming interface that is used to create the client and the server application. It is not a special API designed to make it easy for users inexperienced with it. It is important to use available resources e.g. being able to search the SDK.