It's all about the answers!

Ask a question

How to get the next state or the current action?


Albert Yao (5411322) | asked Dec 28 '12, 3:37 a.m.
I have written javascript to set the value set of an attribute, and the value set depends on the state of work item, it looks like this:

var state = workItem.getValue(WorkItemAttributes.STATE);
var userOptions = [];
if (state == "1")
{
userOptions.push("Test Team");
}
else
{
userOptions.push("Requirement Manager");
}

When performing an action before saving, the state is still the old value(the original/source state), and the value set is not right, after saving, the attribute give an red asterisk, user needs to modify/choose the attribute's value manually/again.
This behavior is very different from ClearQuest that when performing an action in CQ before saving, the state's value has changed to new/destination one.

Comments
Albert Yao commented Dec 28 '12, 3:44 a.m.

Anybody could give the way getting the new/next/destination state value will be very appreciated.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Dec 28 '12, 3:04 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can only access the current state in JavaScript. You can detect a state change only if your JavaScript has only one dependency which is to the state attribute. You can not access the workflow with JavaScript. There is no API available in JavaScript to access the workflow.

This has been discussed here several times in this forum already. Try searching for Potts.

 If that is not sufficient, you need to look at creating a java based extension. http://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/ and other posts shows some examples.

Your answer


Register or 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.