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

How can i retrieve the new state value of WI with script based values?

Using workItem.getValue(WorkItemAttributes.STATE) only shows me the current state "saved" on my WI. If i change the WI state nothing happens.. only after i save my work item. Is this then expected behavior? there is an alternative way?

1

1 vote



2 answers

Permanent link
Hi Fausto,

this is as designed. Please see https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/1093 Lab 5 for more information. Scrips only get triggered when attributes change. You can also only have a dependency to the state attribute today if you want to know the stat changed, If you need to do something more elaborate, you need to create an advisor. Start here if you want to go that route.

0 votes

Comments

Hi Ralph,


i agree when you say that scripts only get triggered when attributes change. But why i always get the actual state saved at my WI?? 

Example: i have a "foo" field that has "state" field as a dependency.

My "foo" field has a "script based filtered value set". Inside this script, i call a webservice based on WI state. But so far, when i change WI state and then click at my value set picker, the old state (actual state persisted at server side) is considered instead of the new value.

Do you have a clue?

Hi Fausto,

that is an interesting observation. I think what you do when selecting the new state is basically selecting the action. The Java API is designed in a way that you save the work item and provide the action as well. So the state change does actually happen after the save. This is reflected by the case that the new state is available only after saving. I think it would be desirable to have access to the state change as well. You might want to open an enhancement request.

1 vote

I looked into the API used for attribute customization for http://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/, I am not even sure the state change can be detected with the available API.


Permanent link

Hi, Ralph, 

could you confirm that whether the "Java Based Value Provider" API of RTC is able to detect the state change of WI?

0 votes

Comments

The Java API has pretty much the same input data the JavaScript has. From the input only conditions get the action that allows to calculate the target state.

So for all other provider this is a no. I am not sure if you could use the Java API to get more information, especially since I only very recently learned that the Java provider can get called in a different way (on save and not on change in a dependent attribute).

Thanks, Ralph, looking foward to your blog about "the Java provider can get called in a different way"!

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: Apr 15 '13, 4:48 p.m.

Question was seen: 5,501 times

Last updated: Jul 05 '17, 11:15 p.m.

Confirmation Cancel Confirm