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

How to get the next state or the current action?

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.

0 votes

Comments

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



One answer

Permanent link
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.

0 votes

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

Question asked: Dec 28 '12, 3:37 a.m.

Question was seen: 5,736 times

Last updated: Dec 28 '12, 3:04 p.m.

Confirmation Cancel Confirm