Setting date attribute based on Work item status
Hi
2 answers
The function getWorkflowAction() definitely works, within a Condition script. According to the document,
Conditions are a special type of customization that is used to dynamically determine required attributes. You cannot explicitly call a Condition script within a Calculated Value script.
You requirement states that the Date field is modified based on the "change" of the state ("reaches" in your description), not really the "value" of the state. You can try to use the State field only to trigger the Calculated Value script. Depending on your actual requirement, you may have to implement some complicated logic to determine whether and when to modify the Date field. Writing a Java-based advisor will be a better alternative if you are not limited to JavaScript only.
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.
Comments
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.
The Java code is used in
String actionId = configuration.getProviderContext() .getWorkflowAction();