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

How to get the state Identifier by state name by program?

Hi, 
If I create query in API to get the status= resolved work item, I need to establish the stateExpression, this need the state identifier. But I only know the state name like resolved.

So how can I get the the state identifier by it name?

0 votes



One answer

Permanent link
Jia,

you can either look it up in the process XML, or you can look it up while debugging or you could write a small tool to look at the data. Based on the ProgrammaticWorkItemCreation wiki page example:

        int id = new Integer(idString).intValue();

        IWorkItem workItem = workItemClient.findWorkItemById(id,
                IWorkItem.FULL_PROFILE, null);
       
        Identifier<IState> state=workItem.getState2();
        String stateID = state.getStringIdentifier();
       
        System.out.println("State: " + stateID + ".");

0 votes

Comments

You can also iterate through the available states using the workflow manager.

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

Question asked: Aug 14 '12, 2:28 a.m.

Question was seen: 5,033 times

Last updated: Aug 14 '12, 6:08 a.m.

Confirmation Cancel Confirm