How Can I See Which Attributes are Changing in a Server-Side Pre-Condition?
In our process, we disallow changes to work items once they have entered a "closed" state. In addition, only certain power users are allowed to re-open closed work items. One of our users has requested that we provide a means for them to add comments to closed work items, but continue to restrict all other changes.
We think the best way to support this would be to create a server-side pre-condition operation behavior that checks on work item save to see if the only change is an added comment. I'm unsure how to do this. I think I know how to check whether a specific attribute has changed by comparing the old state and the new state, but I have two issues with that approach:
Is there a way to see what exactly changed in a work item without explicitly checking a specific attribute? Ideally, I'd like to get an enumerated list of changes. |
Accepted answer
1. works for pre-conditions
2. far as I know, there is no list of just changes but you could make a list pretty easily.. from the oldState get the list of attributes WorkItemServer.findAttributes(projectArea, monitor) - have to load access to the IWorkItemServer service then loop thru the old-state workitem (hasAttribute == true) compare attribute old = new if not equal, add to a list collection if handles compare UUIDs for equal once done, then process the list Nate Decker selected this answer as the correct answer
Comments
Nate Decker
commented Jan 06 '15, 8:37 a.m.
Thanks. That is helpful. I'll try to head down that route and if I'm successful, I'll come back and mark this answer as accepted.
sam detweiler
commented Jan 06 '15, 8:41 a.m.
and u can see how to handle different attributes here in my utility that dumps the attributes of workitems found in a query result list (accepted answer)
|
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.