Setting date attribute based on Work item status
Hi
i have a requirement to set date attribute to current date as soon as the work item reaches a certain state - lets say "Ready for QA". I am able to perform up till this level but the limitation is the value of date attribute will keep on changing as soon as there is modification in some other attributes of work item. How can i restrict the Java script to only run once when the state is being achieved not afterwards.
I have seen conditions getWorkflowAction() but i have not seen a single working example. Can I return a workflow action from a condition and store in a temporary attribute and use it my main java script ?
Can I call the condition from Calculated Values ?
|
2 answers
The function getWorkflowAction() definitely works, within a Condition script. According to the document,
|
Ralph Schoon (63.1k●3●36●46)
| answered Oct 04 '17, 4:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can definitely NOT access getWorkflowAction() from a calculated value in JavaScript
For all I know it is hard to detect state changes in calculated attributes. I don't think it is better if you use Java instead of JavaScript, but I did not try hard. I know some users have used hidden attributes to store state values in order to be able to detect that a state change has happened. I find that pretty ugly.
The best option I think would be to use a follow up action that checks on work item save if the attribute has to be changed and does it.
Comments
Nitin Kaushik
commented Oct 04 '17, 7:49 a.m.
Reasonable enough not to have some hidden attributes which can be cumbersome in a way. I will try to see a work around with follow up action.
Can someone also help me with any working example of getWorkflowAction() in condition ?
The Java code is used in
and
You get it from the provider configuration:
String actionId = configuration.getProviderContext() .getWorkflowAction();
So if it is not provided in the first place in a calculated value, there is likely no way to get at the data.
In a follow up action you have better ways to detect a state change. See the examples here https://rsjazz.wordpress.com/?s=participant
|
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.