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

Can I get the state group within JavaScript?

I know that I can get the STATE of the work item in a validator by using
            var wiState = workItem.getValue(WorkItemAttributes.STATE);


We are trying to do a validator for a different attribute based on StateGroups (basically, a value is okay during "Open" state groups but an error during "In Progress" state groups.

I can do this just by checking every possible state, but it would be easier if I could just get the state group.

Susan

0 votes

Comments

Be certain to make the validated attribute dependent on state changes, too, as a change in the state may need to re-evaluate. There's some discussion of working with state in this other post: https://jazz.net/forum/questions/94496/how-can-i-get-the-old-state-and-new-state-use-javascript-in-calculated-value



One answer

Permanent link
I don't think you can do this from JavaScript. You would need to query the process specification workflow information in order to retrieve the state groups and see which one the state of the work item is in. Even if you could do this, I'm not sure you'd want to as it could be a long-running operation (dealing with all that XML in JavaScript...) and could make your UI rather sluggish.

JavaScript API

RTC provides a limited JavaScript API that can be used for Attribute Customization. The JavaScript API is very limited and allows only to access attribute data in the context of the work item the attribute customization runs. 

I would bet you could to this with a server-side Java contribution.

0 votes

Comments

Yes, I am pretty sure you can't access that data in JavaScript. For any item you can get the label/name, and the value (which is the UUID or ID for complex data). I am not aware of any more data that can be accessed.
Dependent on the problem, use a participant/advisor or create a java based value provider as described here: https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/

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

Question asked: Oct 06 '13, 8:58 p.m.

Question was seen: 3,799 times

Last updated: Oct 09 '13, 1:51 a.m.

Confirmation Cancel Confirm