Defect Count
Hi All,
2 answers
Hi Kiran
I guess com.ibm.team.workitem.defectWorkflow.state.s6 is the reopened state. In your script, the logic is
when it is at reopened state, each save will add 1 to defect count.
So the result is expected.
What you want is to count only when there is state changed to reopen hence you would need to have another attribute storing previous state and by comparing that state with the current state, when there is a state change and state is com.ibm.team.workitem.defectWorkflow.state.s6 then you increase 1 to defect count.
There is some explanation in the below two posts:
https://jazz.net/forum/questions/224213/reopen-action-counter-using-attribute-customization-in-dojo-js
https://jazz.net/forum/questions/226599/can-i-generate-other-attributes-that-pull-current-date-when-state-changed
In addition to Dons comment please note that attribute calculation scripts can run multiple times and not, which is likely your assumption, only once. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization for a description.
You also want to carefully read the section about state id's and special cases in the same documentation.
Maybe Dons links help.