why my calculated value script run even when the change is not triggered?
3 answers
I think the problem here is your assumption that you can detect a state change in a JavaScript attribute customization (calculated value?) for all I know you can't. The only ways to be able to do so would be the ability to access the old state which you don't have, access to the action which you don't have except in conditions or storing the old state in a hidden attribute, which I don't see.
Hi Ralph,
You just made things very confusing.
Refreshing a page does not change anything of the work item. If you see that an attribute has an incorrect value, it is a "display" issue.
The calculated value provider will be executed at different timings, and you should understand when it will be executed.
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_based_calculated_values
As far as I know, reusing an attribute does not share the provider configurations.
And finally, different types of work items are likely using different workflows, hence the state ID can be different. Make sure that you specify the correct state ID in your code.