Reputation: 13
I am trying to create TFS 2013 server side plugin which will transition the work item state depending upon certain fields. The fields are being updated correctly, but not refreshed as the work item is opened in client (VS team explorer). I need to manually press the refresh button to display the correct state.
Can I force refresh the displayed work item after state change from plugin?
Following is the code which is handling the work item changed event.
if (null != workItem)
{
workItem.PartialOpen();
if (!workItem.Fields["ALMTool.FF.Team.Leader"].Value.Equals(string.Empty))
{
if (workItem.Fields["System.State"].Value.Equals("Raised"))
{
workItem.State = "Analyse";
}
}
else
{
workItem.State = "Raised";
}
workItem.Save();
workItem.Store.RefreshCache(true);
//workItem.Close();
workItem.SyncToLatest();
}
Upvotes: 1
Views: 616
Reputation: 13
Beytan, Yes If writing client side plugin, then I need to delpoy library to each client. But I was trying to avoid that by implementing TFS server side plugin. But server will be loaded with the workitemchange Event handlers. So now I am investigating the client side add-ins to automate the state transitions.(Shouldn't be that hard :))
Upvotes: 0
Reputation: 2263
I've had the same need long time ago. But I was trying to achieve this in Web Access rather than Team Explorer. For Web Access, this was not possible, because of a simple explanation:
My implementation was in server-side and the operation
refresh
is actually happening in client-side.
But I think Team Explorer will not be able to do it either, since TFS don't give any library to make UI operation like "Open Work Item Window, Open Pending Changes Windows, etc."
You've already done the SyncToLatest
and TFS will force the user to refresh first in order to make any change on the work item after your operation, but the user has to refresh
the work item client-side first, manually.
If you want to achieve this without the user manually refreshing and Web Access is ok for you, you should check if your implementation could be done using TFS Web Access Extensions which are run client-side. You can take a look and gather detailed information about them from Serkan's blog.
Upvotes: 1