How to update attribute value based on workflow action
Hello,
I am looking to update an attribute value of a work item on a save action, depending upon the action that the user selected when hitting save. For example, our defect work item has Retest and Reopen states/transitions, and we have date fields for both to indicate the day it was set to retest or reopened. We set them manually now, but I would like those to be read only attributes that are populated automatically on save based on the transition.
Our server admin doesn't allow Java extenstions, so I have been looking a bit at the JavaScript API for attribute customization. However, I am unable to find any way with the options given to accomplish what I'm looking for. Using a Calculated value would make the most sense, but as far as I can tell you have no knowledge of the action that was fired, only the current state. I see a getWorkflowAction() in the API but that's only accessible on Conditions, which don't look like they're really used to set attribute values.
Any advice on the best way to accomplish this?
Ryan
|
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Apr 16 '14, 4:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There are several approaches I have seen. My preferred approach would be a participant. See the following posts with examples: https://rsjazz.wordpress.com/?s=participant. The paticipant can easily detect the state change and then modify the value as needed. It has all API available you could ask for and it is a proven solution.
I have seen people trying this with JavaScript - a calculated value that passes the current value and only changes it in case of a state change. The trouble is, that there is no reliable way to detect the state change. I think you can access the action selected, but that is about it. Ryan Koppelman selected this answer as the correct answer
Comments
Ryan Koppelman
commented Apr 16 '14, 8:14 p.m.
Thanks, it sounds like this probably is the best approach. I will see if I can work with my server admin to get an exception in deploying this customization. |
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.