It's all about the answers!

Ask a question

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


1
1
Fausto Lemos (16811518) | asked Apr 15 '13, 4:48 p.m.
edited Apr 15 '13, 5:10 p.m. by Ralph Schoon (63.1k33645)
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?

2 answers



permanent link
Albert Yao (5411322) | answered Jul 05 '17, 5:02 a.m.

Hi, Ralph, 

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


Comments
Ralph Schoon commented Jul 05 '17, 5:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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).


Albert Yao commented Jul 05 '17, 11:15 p.m.

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


permanent link
Ralph Schoon (63.1k33645) | answered Apr 15 '13, 5:14 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Apr 15 '13, 5:14 p.m.
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.

Comments
Fausto Lemos commented Apr 15 '13, 7:51 p.m.

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?


1
Ralph Schoon commented Apr 16 '13, 1:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Ralph Schoon commented Jun 27 '13, 8:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

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.