Can Preconditions Display Warnings Instead of Errors?
I am currently trying to write a precondition that warns users to put in a comment when they add one or more values to an enum list. I am running this precondition on the server side and would want the warning to display after the work item is saved. Here is the code I have running inside my if statement if a new comment has not been added.
IAdvisorInfo createProblemInfo = collector.createProblemInfo("Need New Comment in Discussion!", "You must add a new comment in the Discussion area explaining why this Defect/Feature needs input from the team added in Needs Input From", "warning");
createProblemInfo.setSeverity(IProcessReport.WARNING);
collector.addInfo(createProblemInfo);
Would this only work with the client side? Can warnings be displayed on workitems on the server side?
One answer
Work item save advisors/preconditions work as follows:
- The user saves the work item.
- Within the save transaction, the advisor tests if the save should happen or not
- The advisor adds all the causes that prevent the save and the save fails
- The advisor runs in the server and the fails/warnings/whatever show up in the UI, regardless if browser or Eclipse or any other client. In the browser you get the result as overlay. In Eclipse there is a special process advisor view.
-
There is an extension point for work item advisors that run in the Eclipse client, I would suggest to use the server side extension point, if you have the data needed on server side. This avoids the need to deploy client extensions and works for all clients.