Can I Generate Other Attributes that Pull "Current Date" when State Changed?
Creation Date is automatically created when someone creates a Work Item within RTC. Is there a way that I can have other attributes (i.e. "Assigned Date", "Start Date", etc), that get set automatically like "Creation Date" when the state is changed and Save is selected? For example, we would like to track when a Work Item is assigned. We have a state called "Assigned". When state "Assigned" is selected and "Save" is clicked, can a Timestamp attribute called
Assigned" be set by the current date/time?
Assigned" be set by the current date/time?
One answer
There are ways to do that. The question has in one or another form being asked a lot of times already. See https://www.google.com/search?q=behavior+editor+configuration+site:jazz.net for some of the questions and answers.
My summary:
It is very hard to reliably detect a state change in an attribute customization. It would be necessary to store a state in a hidden attribute and use that to determine the state actually changed. I think it would be better to use a custom work item save follow up action/participant, as that can reliably detect a state change. Here some examples how they wold look like: https://rsjazz.wordpress.com/?s=participant
In JavaScript Attribute customization, you can only see the action in conditions, where you can't use them to set an attribute.
As far as I can tell, the only way users have been able to detect a state change in calculated value providers so far was, by storing the state in a hidden custom attribute (maybe boolean works as well) and detecting the state change by comparing the value there and the new state value (which this attribute is dependent upon). Store the new state and let that trigger another script dependent on this attribute.
The other calculated attribute provider depends on that. If the value changes and the state is the one you want to count, you could save the date, I suppose. Your attribute would only be recalculate if a state changes and you could return the old date as long as the state (in the hidden attribute) is not the one you are interested in.
I have never tried that, especially because attribute customization
does not run in the visual studio client, the shell and in any automation
so, if you want something accurate, a work item save (server) follow up action is the better, more reliable choice.
My summary:
It is very hard to reliably detect a state change in an attribute customization. It would be necessary to store a state in a hidden attribute and use that to determine the state actually changed. I think it would be better to use a custom work item save follow up action/participant, as that can reliably detect a state change. Here some examples how they wold look like: https://rsjazz.wordpress.com/?s=participant
In JavaScript Attribute customization, you can only see the action in conditions, where you can't use them to set an attribute.
As far as I can tell, the only way users have been able to detect a state change in calculated value providers so far was, by storing the state in a hidden custom attribute (maybe boolean works as well) and detecting the state change by comparing the value there and the new state value (which this attribute is dependent upon). Store the new state and let that trigger another script dependent on this attribute.
The other calculated attribute provider depends on that. If the value changes and the state is the one you want to count, you could save the date, I suppose. Your attribute would only be recalculate if a state changes and you could return the old date as long as the state (in the hidden attribute) is not the one you are interested in.
I have never tried that, especially because attribute customization
does not run in the visual studio client, the shell and in any automation
so, if you want something accurate, a work item save (server) follow up action is the better, more reliable choice.
Comments
Thanks Ralph, I was hoping it was much simpler since "Created Date" seems to work with the initial saving of a Work Item. I was hoping to do something similar and just compare a state change and when that occurred capture the current date/time in the custom attribute.
Appreciate your time to respond. Will have to have the customer just click on the attribute and select the current date/time for now. Will look at the cooler implementation at a later time.