How to force selection of a Planned For which has not already completed
We are struggling to meet this requirement. Can you help us find a solution? We are thinking it is necessary to create a precondition and do some Java coding, but open to other solutions. Please note the below unacceptable solutions: (1) Check "A release is scheduled for this iteration" in the Edit Iteration window from Overview tab of e.g. project area. This causes the iteration to not appear in Planned For listbox. (2) In [Window] > [Preferences] > [Work Items] > [Hide past iterations] option in Eclipse client. We can't check this works, since there is a defect which does not persist the check made, but we think this causes the iteration to not appear in Planned For listbox. In either of these cases past iterations can be prevented from appearing in the Planned For list box, but unfortunately if the past iteration is already set in the workitem, when you next save the work item, you will not be told to select a current one. We tried using a script to achieve this functionality by resetting the contents of Planned For listbox to only current iterations in a Script Based Value Set (https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_Based_Value_Set), but the problem is how to obtain information about plans.. We have the same problem if we try to validate the value that is set in the Planned For list box via a Condition (https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Conditions). We think it would be necessary to call REST API from Javascript, but it is not clear how this might be done. We tried debugging a bit and came up with below.. but I think it would give us XML to parse or something and we do not know how to make such a REST API call from the script. So after that we thought it would be better to approach this with a Custom Operation Advisors. We have found the below article more useful than the RTC 4.0 Extensibility Lab Exercises. Most of the example code is exactly what we need. Rational Team Concert - Creating Custom Operation Advisors https://jazz.net/library/article/495 This bit is good for showing the user an error: IAdvisorInfo problem = collector.createProblemInfo( "Old Target", "The target has already finished. Choose a different target. : " + sourceworkItem.getWorkItemType(), PROBLEM_TYPE); collector.addInfo(problem); |
Accepted answer
Ralph Schoon (63.6k●3●36●46)
| answered Mar 28 '13, 6:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Mar 28 '13, 6:45 a.m. i. How can we obtain plan/target type information(such as iterations)?You should not attempt to modify the UI. You would have to modify all Clients, Web, Eclipse, etc. and that is not feasible and basically too expensive. ii. How can we check what has actually been selected by the user in Planned For list box? We are thinking this might be a REST API call.Again, you don't do anything with the UI, you create a custom pre-condition also called advisor for the server WorkItem Save operation (as you suggest in your initial question). On save you check if the condition (state, WI type etc) to trigger it is given. If so, you would get the planned for (target) attribute of the work item new state, potentially check if it has been changed, against the old state and check if it is completed or not. If the iteration is completed prevent save and create a message why. See http://rsjazz.wordpress.com/2012/10/05/handling-iterations-automation-for-the-planned-for-attribute/ for code around iterations. This is client code, but the API should be similar in a pre-condition on the server. Only the client libraries need to be replaced with the Services on the server accessible by getService(). For more information see other posts on my blog and https://jazz.net/library/article/1000 . Ian Wark selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.6k●3●36●46)
| answered Mar 28 '13, 4:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Mar 28 '13, 6:01 a.m.
Hi Ian,
this post is confusing me. What do you want to achieve? A good part of the text is clutter and I can't really read it. To answer we need a good description of what you want to achieve. If I assume you want to prevent completed iterations to be selected for work items in some cases, my answer would be:
Comments
Ian Wark
commented Mar 28 '13, 5:42 a.m.
Ralph,
Ian Wark
commented Mar 28 '13, 5:43 a.m.
Given that we cannot achieve this behaviour without some customization, and given that we cannot achieve this using Javascript.. we are looking for help at coding this in Java. We ask because the APIs are not so straightforward to apply.
Ralph Schoon
commented Mar 28 '13, 5:57 a.m.
| edited Mar 28 '13, 6:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Ian,
Preformatted code that has been pasted out of some editorUse the "View HTML source" button (top right button) to add the tag. I already provided you with hints on the API in my original answer. As far as I can tell, you can only access the data using the Java API, like used in the linked blog posts. I am no REST expert, but I don't see how REST would apply here. I would seriously suggest not to try to modify the UI, but to try an Advisor/precondition. I am also concerned that what the customer wants to do does not increase quality at all, if, for example, it enforces changing planned for after a work item has been closed and completed for like 3 years. So be careful. I still remember times where I came to work only to find out I had to spend three hours of my day to update mandatory attributes on closed work items and invent data, just because some genius came up with these useless required attributes over night and did not consider completed work. It is also not contributing to quality. |
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.