How can i retrieve the new state value of WI with script based values?
![]()
Fausto Lemos (168●1●15●18)
| asked Apr 15 '13, 4:48 p.m.
edited Apr 15 '13, 5:10 p.m. by Ralph Schoon (61.8k●3●36●43)
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
![]()
Ralph Schoon (61.8k●3●36●43)
| 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 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
Hi Fausto,
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.
|