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
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
One answer
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.
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/
Comments
Millard Ellingsworth
FORUM ADMINISTRATOR / JAZZ DEVELOPER Oct 08 '13, 9:38 p.m.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