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

java api - how to find a work item using a custom attribute

 java api - rather than using int id ..how to find a work item using a custom attribute?

Please guide. 

0 votes

Comments

Please tag your questions with a product name. I don't want to have to fix all your questions.


Accepted answer

Permanent link

 You can use expressions: https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/

This allows to basically create an expression that acts as a work item query. It is possible to define conditions, including for custom attributes.

Reverse Reverse selected this answer as the correct answer

0 votes

Comments

  I have to say - this is the most horrible piece of API ever written..

A simple task can take hours.

I have a saved query but through API i cant pass the parameter.
Then found out about creating on-the-fly queries with expression.

 I have is a custom attribute [custom] ..
All I need is give me all work items having [custom =1]

THIS API SUCKS 

 IQueryableAttribute attribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(currProject, IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, null);

how can i use custom attribute here ?

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.  

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,954

Question asked: Sep 24 '19, 12:25 p.m.

Question was seen: 766 times

Last updated: Sep 26 '19, 2:10 a.m.

Confirmation Cancel Confirm